Merge pull request #11332 from ToolJet/fix/component-saving-on-page-clone

Fix: remove events and exposed variables from component definition to avoid backend Component entity error
This commit is contained in:
Johnson Cherian 2024-11-18 18:33:15 +05:30 committed by GitHub
commit d02174e9cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1192,8 +1192,16 @@ export const createComponentsSlice = (set, get) => ({
'setComponentProperty'
);
const oldComponent = get().modules[moduleId].pages[currentPageIndex].components[componentId].component;
const { events, exposedVariables, ...filteredDefinition } = oldComponent.definition || {};
const diff = {
[componentId]: { component: get().modules[moduleId].pages[currentPageIndex].components[componentId].component },
[componentId]: {
component: {
...oldComponent,
definition: filteredDefinition,
},
},
};
if (saveAfterAction) {
@ -1236,8 +1244,16 @@ export const createComponentsSlice = (set, get) => ({
);
}
const oldComponent = get().modules[moduleId].pages[currentPageIndex].components[componentId].component;
const { events, exposedVariables, ...filteredDefinition } = oldComponent.definition || {};
const diff = {
[componentId]: { component: get().modules[moduleId].pages[currentPageIndex].components[componentId].component },
[componentId]: {
component: {
...oldComponent,
definition: filteredDefinition,
},
},
};
if (saveAfterAction) {