mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
fix: auto save when component def changes (#2638)
* fix: auto save when component def changes * remove callback
This commit is contained in:
parent
2e62d7480a
commit
d45ef4865e
2 changed files with 23 additions and 22 deletions
|
|
@ -503,8 +503,9 @@ class Editor extends React.Component {
|
|||
},
|
||||
this.handleAddPatch
|
||||
);
|
||||
|
||||
return setStateAsync(_self, newDefinition);
|
||||
setStateAsync(_self, newDefinition).then(() => {
|
||||
this.autoSave();
|
||||
});
|
||||
};
|
||||
|
||||
cloneComponent = (newComponent) => {
|
||||
|
|
|
|||
|
|
@ -162,30 +162,30 @@ export const Inspector = ({
|
|||
},
|
||||
};
|
||||
|
||||
componentDefinitionChanged(newComponent).then(() => {
|
||||
// Child componets should also have a mobile layout
|
||||
const childComponents = Object.keys(allComponents).filter((key) => allComponents[key].parent === component.id);
|
||||
componentDefinitionChanged(newComponent);
|
||||
|
||||
childComponents.forEach((componentId) => {
|
||||
let newChild = {
|
||||
id: componentId,
|
||||
...allComponents[componentId],
|
||||
};
|
||||
// Child componets should also have a mobile layout
|
||||
const childComponents = Object.keys(allComponents).filter((key) => allComponents[key].parent === component.id);
|
||||
|
||||
const { width, height } = newChild.layouts['desktop'];
|
||||
childComponents.forEach((componentId) => {
|
||||
let newChild = {
|
||||
id: componentId,
|
||||
...allComponents[componentId],
|
||||
};
|
||||
|
||||
newChild['layouts'] = {
|
||||
...newChild.layouts,
|
||||
mobile: {
|
||||
top: 100,
|
||||
left: 0,
|
||||
width: Math.min(width, 445),
|
||||
height: height,
|
||||
},
|
||||
};
|
||||
const { width, height } = newChild.layouts['desktop'];
|
||||
|
||||
componentDefinitionChanged(newChild);
|
||||
});
|
||||
newChild['layouts'] = {
|
||||
...newChild.layouts,
|
||||
mobile: {
|
||||
top: 100,
|
||||
left: 0,
|
||||
width: Math.min(width, 445),
|
||||
height: height,
|
||||
},
|
||||
};
|
||||
|
||||
componentDefinitionChanged(newChild);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue