[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:
Arpit 2023-10-10 11:27:53 +05:30 committed by GitHub
parent 3ec5e6d999
commit 75cedb49e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View file

@ -19,6 +19,9 @@ import { useCurrentState } from '@/_stores/currentStateStore';
import { useAppVersionStore } from '@/_stores/appVersionStore';
import { useEditorStore } from '@/_stores/editorStore';
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;
@ -79,7 +82,7 @@ export const Container = ({
shallow
);
const [boxes, setBoxes] = useState(components);
const [boxes, setBoxes] = useState([]);
const [isDragging, setIsDragging] = useState(false);
const [isResizing, setIsResizing] = useState(false);
const [commentsPreviewList, setCommentsPreviewList] = useState([]);
@ -195,7 +198,12 @@ export const Container = ({
if (componendAdded) {
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
}, [boxes]);

View file

@ -15,6 +15,8 @@ import { useCurrentState } from '@/_stores/currentStateStore';
import { useAppVersionStore } from '@/_stores/appVersionStore';
import { shallow } from 'zustand/shallow';
import { useMounted } from '@/_hooks/use-mount';
// eslint-disable-next-line import/no-unresolved
import { diff } from 'deep-object-diff';
const NO_OF_GRIDS = 43;
@ -251,7 +253,11 @@ export const SubContainer = ({
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
}, [boxes]);

View file

@ -99,6 +99,9 @@ function updateValueInJson(json, path, value) {
export function isParamFromTableColumn(appDiff, definition) {
const path = generatePath(appDiff, 'columns') || generatePath(appDiff, 'actions');
if (!path) {
return false;
}
const value2 = getValueFromJson(definition, path);