fixes: cloned/copied table with actions (#7758)

This commit is contained in:
Arpit 2023-10-10 18:08:35 +05:30 committed by GitHub
parent 87f52b484b
commit 30452d94d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -210,15 +210,6 @@ const computeComponentDiff = (appDiff, currentPageId, opts) => {
type = updateType.componentDeleted;
operation = 'delete';
} else if (
(opts.includes('containerChanges') || opts.includes('componentDefinitionChanged')) &&
!opts.includes('componentAdded')
) {
const currentPageComponents = appDiff?.pages[currentPageId]?.components;
updateDiff = toRemoveExposedvariablesFromComponentDiff(currentPageComponents);
type = opts.includes('containerChanges') ? updateType.containerChanges : updateType.componentDefinitionChanged;
} else if (opts.includes('componentAdded')) {
const currentPageComponents = appDiff?.pages[currentPageId]?.components;
@ -237,6 +228,19 @@ const computeComponentDiff = (appDiff, currentPageId, opts) => {
const metaAttributes = _.keys(metaDiff.definition);
metaAttributes.forEach((attribute) => {
if (metaDiff.definition[attribute]?.actions && !_.isEmpty(metaDiff.definition[attribute]?.actions?.value)) {
const actions = _.toArray(metaDiff.definition[attribute]?.actions?.value);
metaDiff.definition = {
...metaDiff.definition,
[attribute]: {
...metaDiff.definition[attribute],
actions: {
value: actions,
},
},
};
}
result[id][attribute] = metaDiff.definition[attribute];
});
}
@ -262,6 +266,15 @@ const computeComponentDiff = (appDiff, currentPageId, opts) => {
}, {});
type = updateType.componentDefinitionChanged;
} else if (
(opts.includes('containerChanges') || opts.includes('componentDefinitionChanged')) &&
!opts.includes('componentAdded')
) {
const currentPageComponents = appDiff?.pages[currentPageId]?.components;
updateDiff = toRemoveExposedvariablesFromComponentDiff(currentPageComponents);
type = opts.includes('containerChanges') ? updateType.containerChanges : updateType.componentDefinitionChanged;
}
return { updateDiff, type, operation };