mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
fixes: deletes children components on deleting parent
This commit is contained in:
parent
8dc529c600
commit
26873b0366
4 changed files with 24 additions and 26 deletions
|
|
@ -121,6 +121,11 @@ export const Container = ({
|
|||
[isContainerFocused, appDefinition, focusedParentIdRef]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setBoxes(components);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [JSON.stringify(components)]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleClick = (e) => {
|
||||
if (canvasRef.current.contains(e.target) || document.getElementById('modal-container')?.contains(e.target)) {
|
||||
|
|
|
|||
|
|
@ -491,7 +491,6 @@ const EditorComponent = (props) => {
|
|||
|
||||
//! Needs attention
|
||||
const handleEvent = (eventName, event, options) => {
|
||||
console.log('--------arpit handleEvent:::', { eventName, event, options });
|
||||
return onEvent(editorRef, eventName, event, options, 'edit');
|
||||
};
|
||||
|
||||
|
|
@ -981,7 +980,7 @@ const EditorComponent = (props) => {
|
|||
);
|
||||
} else {
|
||||
childComponents = Object.keys(newDefinition.pages[currentPageId].components).filter(
|
||||
(key) => newDefinition.pages[currentPageId].components[key].parent === componentId
|
||||
(key) => newDefinition.pages[currentPageId].components[key].component.parent === componentId
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -830,18 +830,9 @@ export const EventManager = ({
|
|||
index: index,
|
||||
};
|
||||
});
|
||||
console.log('----arpit reorder events:: ', { result, events, reorderedEvents });
|
||||
|
||||
setEvents(result);
|
||||
|
||||
// updateAppVersionEventHandlers(
|
||||
// [
|
||||
// {
|
||||
// event_id: updatedEvent.id,
|
||||
// diff: updatedEvent,
|
||||
// },
|
||||
// ],
|
||||
// 'update'
|
||||
// );
|
||||
updateAppVersionEventHandlers(
|
||||
reorderedEvents.map((event) => ({
|
||||
event_id: event.id,
|
||||
|
|
|
|||
|
|
@ -35,20 +35,23 @@ export const useAppDataStore = create(
|
|||
updateState: (state) => set((prev) => ({ ...prev, ...state })),
|
||||
updateAppDefinitionDiff: (appDefinitionDiff) => set(() => ({ appDefinitionDiff: appDefinitionDiff })),
|
||||
updateAppVersion: (appId, versionId, pageId, appDefinitionDiff, isUserSwitchedVersion = false) => {
|
||||
useAppDataStore.getState().actions.setIsSaving(true);
|
||||
appVersionService
|
||||
.autoSaveApp(
|
||||
appId,
|
||||
versionId,
|
||||
appDefinitionDiff.updateDiff,
|
||||
appDefinitionDiff.type,
|
||||
pageId,
|
||||
appDefinitionDiff.operation,
|
||||
isUserSwitchedVersion
|
||||
)
|
||||
.then(() => {
|
||||
useAppDataStore.getState().actions.setIsSaving(false);
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
useAppDataStore.getState().actions.setIsSaving(true);
|
||||
appVersionService
|
||||
.autoSaveApp(
|
||||
appId,
|
||||
versionId,
|
||||
appDefinitionDiff.updateDiff,
|
||||
appDefinitionDiff.type,
|
||||
pageId,
|
||||
appDefinitionDiff.operation,
|
||||
isUserSwitchedVersion
|
||||
)
|
||||
.then(() => {
|
||||
useAppDataStore.getState().actions.setIsSaving(false);
|
||||
})
|
||||
.finally(() => resolve());
|
||||
});
|
||||
},
|
||||
updateAppVersionEventHandlers: async (events, updateType = 'update') => {
|
||||
useAppDataStore.getState().actions.setIsSaving(true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue