Skip to content

[🐛 Bug]: A few scenarios lead to loosing of the user input in the workflow editor #3684

Closed

Description

@Matvey-Kuk
  1. Side-YAML-editor -> Save (!!!!!!) -> Changes lost
  2. Side-YAML-editor -> Run now -> Changes lost
  3. Full-screen-yaml-editor -> Run now -> Changes logs

Kindly asking to other use-cases thoughtfully. Loosing of user input in a very confusing experience.

Screen.Recording.2025-02-25.at.14.48.14.mov

Activity

  1. dosubot commented on Feb 25, 2025

    @dosubot

    To address the issue of losing user input in the workflow editor, you can implement the following strategies:

    1. Track Changes: Ensure that the hasChanges state is used to track unsaved changes in the editor. This is already implemented in the MonacoYAMLEditor component, where the state is updated whenever the editor's content changes.

    2. Save Workflow: Implement a save function that updates the workflow with the current editor content. This is done in the handleSaveWorkflow function, which checks for changes and updates the workflow using the updateWorkflow function.

    3. Prevent Unintended Navigation: Add a browser event listener to warn users about unsaved changes when they attempt to navigate away from the page. This can be done as follows:

      useEffect(() => {
        const handleBeforeUnload = (event) => {
          if (hasChanges) {
            event.preventDefault();
            event.returnValue = '';
          }
        };
      
        window.addEventListener('beforeunload', handleBeforeUnload);
      
        return () => {
          window.removeEventListener('beforeunload', handleBeforeUnload);
        };
      }, [hasChanges]);
    4. Disable Actions: Disable the "Save" button when there are no changes to prevent unnecessary saves. This is already implemented in the MonacoYAMLEditor component by disabling the "Save" button when !hasChanges.

    By implementing these strategies, you can help ensure that user input is not lost during interactions with the YAML editor [1].

    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

  2. added
    Bug
    on Feb 25, 2025
  3. self-assigned this
    on Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions