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:
parent
0f21f1c800
commit
2bdc1b7fbb
2 changed files with 14 additions and 3 deletions
|
|
@ -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,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue