mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
[appdef-2] fixes: on versioned app (switching or creating) version, the componet layout is wrongly updated to the container dnd (#7721)
* fixes: on versioned app (switching or creating) version, the component layout is wrongly updated to the container dnd * fixes: container widget is not saving
This commit is contained in:
parent
3ec5e6d999
commit
75cedb49e8
3 changed files with 20 additions and 3 deletions
|
|
@ -19,6 +19,9 @@ import { useCurrentState } from '@/_stores/currentStateStore';
|
||||||
import { useAppVersionStore } from '@/_stores/appVersionStore';
|
import { useAppVersionStore } from '@/_stores/appVersionStore';
|
||||||
import { useEditorStore } from '@/_stores/editorStore';
|
import { useEditorStore } from '@/_stores/editorStore';
|
||||||
import { shallow } from 'zustand/shallow';
|
import { shallow } from 'zustand/shallow';
|
||||||
|
import _ from 'lodash';
|
||||||
|
// eslint-disable-next-line import/no-unresolved
|
||||||
|
import { diff } from 'deep-object-diff';
|
||||||
|
|
||||||
const NO_OF_GRIDS = 43;
|
const NO_OF_GRIDS = 43;
|
||||||
|
|
||||||
|
|
@ -79,7 +82,7 @@ export const Container = ({
|
||||||
shallow
|
shallow
|
||||||
);
|
);
|
||||||
|
|
||||||
const [boxes, setBoxes] = useState(components);
|
const [boxes, setBoxes] = useState([]);
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
const [isDragging, setIsDragging] = useState(false);
|
||||||
const [isResizing, setIsResizing] = useState(false);
|
const [isResizing, setIsResizing] = useState(false);
|
||||||
const [commentsPreviewList, setCommentsPreviewList] = useState([]);
|
const [commentsPreviewList, setCommentsPreviewList] = useState([]);
|
||||||
|
|
@ -195,7 +198,12 @@ export const Container = ({
|
||||||
if (componendAdded) {
|
if (componendAdded) {
|
||||||
opts.componentAdded = true;
|
opts.componentAdded = true;
|
||||||
}
|
}
|
||||||
appDefinitionChanged(newDefinition, opts);
|
|
||||||
|
const shouldUpdate = !_.isEmpty(diff(appDefinition, newDefinition));
|
||||||
|
if (shouldUpdate) {
|
||||||
|
appDefinitionChanged(newDefinition, opts);
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [boxes]);
|
}, [boxes]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ import { useCurrentState } from '@/_stores/currentStateStore';
|
||||||
import { useAppVersionStore } from '@/_stores/appVersionStore';
|
import { useAppVersionStore } from '@/_stores/appVersionStore';
|
||||||
import { shallow } from 'zustand/shallow';
|
import { shallow } from 'zustand/shallow';
|
||||||
import { useMounted } from '@/_hooks/use-mount';
|
import { useMounted } from '@/_hooks/use-mount';
|
||||||
|
// eslint-disable-next-line import/no-unresolved
|
||||||
|
import { diff } from 'deep-object-diff';
|
||||||
|
|
||||||
const NO_OF_GRIDS = 43;
|
const NO_OF_GRIDS = 43;
|
||||||
|
|
||||||
|
|
@ -251,7 +253,11 @@ export const SubContainer = ({
|
||||||
opts.componentAdded = true;
|
opts.componentAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
appDefinitionChanged(newDefinition, opts);
|
const shouldUpdate = !_.isEmpty(diff(appDefinition, newDefinition));
|
||||||
|
|
||||||
|
if (shouldUpdate) {
|
||||||
|
appDefinitionChanged(newDefinition, opts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [boxes]);
|
}, [boxes]);
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,9 @@ function updateValueInJson(json, path, value) {
|
||||||
|
|
||||||
export function isParamFromTableColumn(appDiff, definition) {
|
export function isParamFromTableColumn(appDiff, definition) {
|
||||||
const path = generatePath(appDiff, 'columns') || generatePath(appDiff, 'actions');
|
const path = generatePath(appDiff, 'columns') || generatePath(appDiff, 'actions');
|
||||||
|
if (!path) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const value2 = getValueFromJson(definition, path);
|
const value2 = getValueFromJson(definition, path);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue