Skip to content
Snippets Groups Projects
Verified Commit 6343bbce authored by Jelle van der Waa's avatar Jelle van der Waa :construction:
Browse files

Re-use the same component instance for open and closed state

The conditional if is unrequired as we can pass `isOpen` to the `open`
property.
parent 30b20f66
No related branches found
No related tags found
No related merge requests found
Pipeline #104618 passed
......@@ -4,7 +4,7 @@ const React = require('react');
import Collapsible from 'react-collapsible'
function StatusSection(props) {
const isOpen = props.open;
const isOpen = props.open || false;
const content = (
<ul>
{props.pkgs.map(function(pkg) {
......@@ -32,10 +32,7 @@ function StatusSection(props) {
const label = `${props.label} (${props.pkgs.length})`;
return (
<div className={ props.label }>
{ isOpen
? <Collapsible trigger={label} lazyRender open>{ content }</Collapsible>
: <Collapsible trigger={label} lazyRender>{ content }</Collapsible>
}
<Collapsible trigger={label} lazyRender open={isOpen}>{ content }</Collapsible>
</div>
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment