Skip to content

Commit

Permalink
Update isOpen var
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Oct 23, 2023
1 parent c77d128 commit 69dc021
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ const COMPONENT_DETAILS_PANEL_ID = 'component_details_panel_id';
*/
export function ResizableWorkspace(props: ResizableWorkspaceProps) {
// Component details side panel state
const [isOpen, setIsOpen] = useState<boolean>(true);
const [isDetailsPanelOpen, setisDetailsPanelOpen] = useState<boolean>(true);
const collapseFn = useRef(
(id: string, options: { direction: 'left' | 'right' }) => {}
);
const onToggleChange = () => {
collapseFn.current(COMPONENT_DETAILS_PANEL_ID, { direction: 'left' });
setIsOpen(!isOpen);
setisDetailsPanelOpen(!isDetailsPanelOpen);
};

// Selected component state
Expand All @@ -59,7 +59,7 @@ export function ResizableWorkspace(props: ResizableWorkspaceProps) {
onChange: ({ nodes, edges }) => {
if (nodes && nodes.length > 0) {
setSelectedComponent(nodes[0]);
if (!isOpen) {
if (!isDetailsPanelOpen) {
onToggleChange();
}
} else {
Expand Down

0 comments on commit 69dc021

Please sign in to comment.