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;
|
||||
}
|
||||
|
||||
if (!appDefinition.pages[currentPageId]?.components) return;
|
||||
|
||||
const newDefinition = {
|
||||
...appDefinition,
|
||||
pages: {
|
||||
|
|
@ -251,7 +253,7 @@ export const Container = ({
|
|||
[currentPageId]: {
|
||||
...appDefinition.pages[currentPageId],
|
||||
components: {
|
||||
...appDefinition.pages[currentPageId].components,
|
||||
...appDefinition.pages[currentPageId]?.components,
|
||||
...boxes,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -709,7 +709,18 @@ class ViewerComponent extends React.Component {
|
|||
};
|
||||
|
||||
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 = () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue