fix(PageComponent): update saveFlow function to pass a modified flow object with updated data property to improve data consistency

fix(PageComponent): update saveFlow function to pass a modified flow object with updated data property to improve data consistency
fix(extraSidebarComponent): update saveFlow function to pass a modified flow object with updated data property to improve data consistency
This commit is contained in:
anovazzi1 2023-11-21 18:39:12 -03:00
commit 2bdc1b7fbb
2 changed files with 14 additions and 3 deletions

View file

@ -187,7 +187,15 @@ export default function Page({
let updatedSeconds = prevSeconds + 1; let updatedSeconds = prevSeconds + 1;
if (updatedSeconds % 30 === 0) { if (updatedSeconds % 30 === 0) {
saveFlow(flow, true); saveFlow(
{
...flow!,
data: reactFlowInstance
? reactFlowInstance!.toObject()
: flow!.data,
},
true
);
updatedSeconds = 0; updatedSeconds = 0;
} }
@ -366,7 +374,10 @@ export default function Page({
useEffect(() => { useEffect(() => {
return () => { return () => {
if (tabsState && tabsState[flow.id]?.isPending) { if (tabsState && tabsState[flow.id]?.isPending) {
saveFlow(flow); saveFlow({
...flow!,
data: reactFlowInstance ? reactFlowInstance!.toObject() : flow!.data,
});
} }
}; };
}, []); }, []);

View file

@ -250,7 +250,7 @@ export default function ExtraSidebar(): JSX.Element {
(isPending ? "" : "button-disable") (isPending ? "" : "button-disable")
} }
onClick={(event) => { onClick={(event) => {
saveFlow(flow!); saveFlow({ ...flow!, data: reactFlowInstance!.toObject() });
}} }}
> >
<IconComponent <IconComponent