Skip to content

The syncWorkflowDraftWhenPageClose method remains pending, preventing the workflow from being saved. #18675

Closed as not planned

Description

@AliceXu521

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • 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.

Image Image Image Image Image Image

✔️ 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.

❌ Actual Behavior

No response

Activity

  1. added
    🌊 feat:workflow
    on Apr 24, 2025
  2. dosubot commented on Apr 24, 2025

    @dosubot

    To address the issue where the syncWorkflowDraftWhenPageClose method remains pending, especially with large payloads in a complex workflow, consider the following solutions:

    1. 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.

    2. 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.

    3. 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.

    4. 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.

    5. 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].

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🌊 feat:workflow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions