You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The syncWorkflowDraftWhenPageClose method remains pending, preventing the workflow from being saved. #18675
I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
Please do not modify this template :) and fill in all the required fields.
Dify version
the latest
Cloud or Self Hosted
Cloud
Steps to reproduce
I created a complex workflow with 112 nodes. After switching browser tabs and returning to the canvas, I noticed that the navigator.sendBeacon request remained in a pending state. I suspect it's due to the request payload being too large, possibly exceeding the browser's limit.
✔️ Expected Behavior
I hope this issue can be addressed. Otherwise, it may cause the following problem: when working with two open canvases — Canvas A and Canvas B — if I copy some panel data from A and paste it into B, then switch back to A to copy more, and return to B, the previously pasted data in B appears to have been undone. This seems to be due to the failure in saving the operation successfully.
To address the issue where the syncWorkflowDraftWhenPageClose method remains pending, especially with large payloads in a complex workflow, consider the following solutions:
Optimize Payload Size: Ensure that the payload is as small as possible by removing unnecessary data. The code already removes properties starting with an underscore (_). Verify that this is effectively reducing the payload size.
Limitations of navigator.sendBeacon: This method is suitable for small payloads. If the payload is too large, it might not be sent successfully. Consider reducing the payload size or using an alternative method for larger data, such as a regular fetch request with error handling and retry logic.
Use Debounced Synchronization: Utilize the debouncedSyncWorkflowDraft function, which helps manage synchronization by reducing the frequency of sync operations. This can be particularly useful for large workflows.
Debugging and Logging: Add logging to check the size of the payload and any errors returned by the server. This can help identify if the payload size is the issue or if there are other errors during synchronization.
Visibility State Handling: Ensure that the handleSyncWorkflowDraftWhenPageClose function correctly handles the visibility state of the document. This ensures that synchronization logic is correctly tied to the document's visibility state.
If the issue persists, consider breaking down the payload into smaller parts or using a different synchronization strategy. Additionally, ensure that event listeners for visibilitychange are correctly set up and removed to prevent potential memory leaks or unexpected behavior [1][2][3].
Activity
dosubot commentedon Apr 24, 2025
To address the issue where the
syncWorkflowDraftWhenPageClosemethod remains pending, especially with large payloads in a complex workflow, consider the following solutions:Optimize Payload Size: Ensure that the payload is as small as possible by removing unnecessary data. The code already removes properties starting with an underscore (
_). Verify that this is effectively reducing the payload size.Limitations of
navigator.sendBeacon: This method is suitable for small payloads. If the payload is too large, it might not be sent successfully. Consider reducing the payload size or using an alternative method for larger data, such as a regularfetchrequest with error handling and retry logic.Use Debounced Synchronization: Utilize the
debouncedSyncWorkflowDraftfunction, which helps manage synchronization by reducing the frequency of sync operations. This can be particularly useful for large workflows.Debugging and Logging: Add logging to check the size of the payload and any errors returned by the server. This can help identify if the payload size is the issue or if there are other errors during synchronization.
Visibility State Handling: Ensure that the
handleSyncWorkflowDraftWhenPageClosefunction correctly handles the visibility state of the document. This ensures that synchronization logic is correctly tied to the document's visibility state.If the issue persists, consider breaking down the payload into smaller parts or using a different synchronization strategy. Additionally, ensure that event listeners for
visibilitychangeare correctly set up and removed to prevent potential memory leaks or unexpected behavior [1][2][3].To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other