Skip to content

Commit

Permalink
Merge pull request #66 from projectstorm/layout_invalidation_fixes
Browse files Browse the repository at this point in the history
Layout invalidation fixes
  • Loading branch information
dylanvorster authored Nov 1, 2024
2 parents b54451e + 5f17139 commit 51fdfa6
Show file tree
Hide file tree
Showing 17 changed files with 1,212 additions and 1,704 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-fans-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@projectstorm/react-workspaces-core': patch
---

Fix redraw issue with resize widgets in some cases when adding a model and a race condition occurs
24 changes: 12 additions & 12 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
"typeface-open-sans": "^1.1.13"
},
"devDependencies": {
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/addon-essentials": "^8.3.3",
"@storybook/addon-essentials": "^8.4.1",
"@storybook/addons": "^7.6.17",
"@storybook/react": "^8.3.3",
"@storybook/react-webpack5": "^8.3.3",
"@storybook/react": "^8.4.1",
"@storybook/react-webpack5": "^8.4.1",
"@storybook/storybook-deployer": "^2.8.16",
"@storybook/theming": "^8.3.3",
"@types/lodash": "^4.17.9",
"@types/node": "^22.7.1",
"@types/react": "18.3.9",
"@types/react-dom": "^18.3.0",
"@storybook/theming": "^8.4.1",
"@types/lodash": "^4.17.13",
"@types/node": "^22.8.6",
"@types/react": "18.3.12",
"@types/react-dom": "^18.3.1",
"react-dom": "18.3.1",
"source-map-loader": "^5.0.0",
"storybook": "^8.3.3",
"webpack": "^5.95.0"
"storybook": "^8.4.1",
"webpack": "^5.96.1"
}
}
14 changes: 7 additions & 7 deletions example-project-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"react-dom": "^18.3.1"
},
"devDependencies": {
"html-webpack-plugin": "^5.6.0",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"html-webpack-plugin": "^5.6.3",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"babel-loader": "^9.2.1",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"webpack": "^5.95.0",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0"
}
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
"devDependencies": {
"babel-loader": "^9.2.1",
"source-map-loader": "^5.0.0",
"@babel/core": "^7.25.2",
"@babel/preset-react": "^7.24.7",
"@babel/preset-env": "^7.25.4",
"@babel/core": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"typescript": "^5.6.3",
"terser-webpack-plugin": "^5.3.10",
"@changesets/cli": "^2.27.8",
"webpack": "^5.95.0",
"@changesets/cli": "^2.27.9",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-node-externals": "^3.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/behavior-divider-dropzone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@emotion/styled": "^11.13.0"
},
"devDependencies": {
"@types/react": "^18.3.9"
"@types/react": "^18.3.12"
}
}
4 changes: 2 additions & 2 deletions packages/behavior-panel-dropzone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@emotion/styled": "^11.13.0"
},
"devDependencies": {
"@types/lodash": "^4.17.9",
"@types/react": "^18.3.9"
"@types/lodash": "^4.17.13",
"@types/react": "^18.3.12"
}
}
2 changes: 1 addition & 1 deletion packages/behavior-resize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@emotion/styled": "^11.13.0"
},
"devDependencies": {
"@types/react": "^18.3.9"
"@types/react": "^18.3.12"
}
}
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@emotion/react": "^11.13.3",
"lodash": "^4.17.21",
"color": "^4.2.3",
"uuid": "^10.0.0"
"uuid": "^11.0.2"
},
"devDependencies": {
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"@types/lodash": "^4.17.9",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/lodash": "^4.17.13",
"@types/uuid": "^10.0.0"
}
}
2 changes: 2 additions & 0 deletions packages/core/src/entities/node/WorkspaceNodeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ export class WorkspaceNodeModel<
addModel(model: WorkspaceModel, position: number = null): this {
super.addModel(model, position);
this.recomputeDivisions();
this.invalidateLayout();
return this;
}

removeModel(model: WorkspaceModel): this {
super.removeModel(model);
this.recomputeDivisions();
this.invalidateLayout();
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from '@emotion/styled';
import { useEffect } from 'react';
import { useForceUpdate } from '../hooks/useForceUpdate';
import { DimensionContainer, IDimension } from '../../core/dimensions/DimensionContainer';
import * as _ from 'lodash';

export interface DimensionTrackingWidgetProps {
dimension: DimensionContainer;
Expand All @@ -14,6 +15,9 @@ export interface DimensionTrackingWidgetProps {
export const DimensionTrackingWidget: React.FC<React.PropsWithChildren<DimensionTrackingWidgetProps>> = (props) => {
const forceUpdate = useForceUpdate();
useEffect(() => {
_.defer(() => {
forceUpdate();
});
return props.dimension.registerListener({
updated: () => {
forceUpdate();
Expand Down
4 changes: 2 additions & 2 deletions packages/defaults/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@fortawesome/fontawesome-svg-core": "^6.6.0"
},
"devDependencies": {
"@types/react": "^18.3.9",
"@types/lodash": "^4.17.9"
"@types/react": "^18.3.12",
"@types/lodash": "^4.17.13"
}
}
2 changes: 1 addition & 1 deletion packages/dropzone-plugin-tabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@fortawesome/fontawesome-svg-core": "^6.6.0"
},
"devDependencies": {
"@types/react": "^18.3.9"
"@types/react": "^18.3.12"
}
}
2 changes: 1 addition & 1 deletion packages/dropzone-plugin-tray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@fortawesome/fontawesome-svg-core": "^6.6.0"
},
"devDependencies": {
"@types/react": "^18.3.9"
"@types/react": "^18.3.12"
}
}
2 changes: 1 addition & 1 deletion packages/model-floating-window/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@emotion/styled": "^11.13.0"
},
"devDependencies": {
"@types/react": "^18.3.9"
"@types/react": "^18.3.12"
}
}
4 changes: 2 additions & 2 deletions packages/model-tabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/react": "^18.3.9",
"@types/lodash": "^4.17.9"
"@types/react": "^18.3.12",
"@types/lodash": "^4.17.13"
}
}
4 changes: 2 additions & 2 deletions packages/model-tray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/react": "^18.3.9",
"@types/lodash": "^4.17.9"
"@types/react": "^18.3.12",
"@types/lodash": "^4.17.13"
}
}
Loading

0 comments on commit 51fdfa6

Please sign in to comment.