Skip to content

Commit

Permalink
Merge pull request #816 from zaxer2/Making-React-Dockview-Demo-work-n…
Browse files Browse the repository at this point in the history
…ice-with-Strict-Mode

Fixing duplicate state in React-Dockview-Demo caused by strict mode
  • Loading branch information
mathuo authored Jan 11, 2025
2 parents 872ec7c + 10fd577 commit c7c1ae9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ const DockviewDemo = (props: { theme?: string }) => {

const onReady = (event: DockviewReadyEvent) => {
setApi(event.api);
setPanels([]);
setGroups([]);
setActivePanel(undefined);
setActiveGroup(undefined);
addLogLine(`Dockview Is Ready`);

event.api.onDidAddPanel((event) => {
setPanels((_) => [..._, event.id]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ const DockviewDemo = (props: { theme?: string }) => {

const onReady = (event: DockviewReadyEvent) => {
setApi(event.api);
setPanels([]);
setGroups([]);
setActivePanel(undefined);
setActiveGroup(undefined);
addLogLine(`Dockview Is Ready`);
};

React.useEffect(() => {
Expand Down

0 comments on commit c7c1ae9

Please sign in to comment.