Bug fix - Clear current service state on browser "back" button press #933#941
Open
ruwinirathnamalala wants to merge 3 commits intobuerokratt:devfrom
Open
Bug fix - Clear current service state on browser "back" button press #933#941ruwinirathnamalala wants to merge 3 commits intobuerokratt:devfrom
ruwinirathnamalala wants to merge 3 commits intobuerokratt:devfrom
Conversation
|
| const initialHistoryState = { | ||
| nodes: JSON.parse(JSON.stringify(nodes)), | ||
| edges: JSON.parse(JSON.stringify(edges)), | ||
| }; |
Collaborator
Author
There was a problem hiding this comment.
The structuredClone approach failed with DataCloneError because flow nodes contain function references (onDelete, onEdit, setClickedNode, update), which cannot be cloned by the structured clone algorithm. The JSON.parse(JSON.stringify()) method is used here to strip functions from nodes before saving to history, which are then manually re-attached during undo/redo operations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




This pull request introduces improvements to state management and initialization for the service flow functionality. The main changes ensure proper cleanup of state when navigating away from the page and enhance the default structure of new services.
State management improvements:
ServiceFlowPagecomponent to reset the service store state when the component unmounts, ensuring consistent behavior including when using the browser back button.Service initialization enhancements:
examplesandentitiesarrays for new services, improving the clarity and completeness of the initial service object.