mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fixes: editor crash on switching versions from viewer
This commit is contained in:
parent
a12ca9fed8
commit
4745d0019c
2 changed files with 15 additions and 2 deletions
|
|
@ -244,6 +244,8 @@ export const Container = ({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!appDefinition.pages[currentPageId]?.components) return;
|
||||||
|
|
||||||
const newDefinition = {
|
const newDefinition = {
|
||||||
...appDefinition,
|
...appDefinition,
|
||||||
pages: {
|
pages: {
|
||||||
|
|
@ -251,7 +253,7 @@ export const Container = ({
|
||||||
[currentPageId]: {
|
[currentPageId]: {
|
||||||
...appDefinition.pages[currentPageId],
|
...appDefinition.pages[currentPageId],
|
||||||
components: {
|
components: {
|
||||||
...appDefinition.pages[currentPageId].components,
|
...appDefinition.pages[currentPageId]?.components,
|
||||||
...boxes,
|
...boxes,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -709,7 +709,18 @@ class ViewerComponent extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleEvent = (eventName, events, options) => {
|
handleEvent = (eventName, events, options) => {
|
||||||
return onEvent(this.getViewerRef(), eventName, events, options, 'view');
|
const latestEvents = useAppDataStore.getState().events;
|
||||||
|
|
||||||
|
const filteredEvents = latestEvents.filter((event) => {
|
||||||
|
const foundEvent = events.find((e) => e.id === event.id);
|
||||||
|
return foundEvent && foundEvent.name === eventName;
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
return onEvent(this.getViewerRef(), eventName, filteredEvents, options, 'view');
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
computeCanvasMaxWidth = () => {
|
computeCanvasMaxWidth = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue