fix(designer-v2): prevent false unsaved-changes flag in monitoring view#9360
Merged
Conversation
Contributor
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | None |
| Commit Type | ✅ | None |
| Risk Level | ✅ | None |
| What & Why | ✅ | None |
| Impact of Change | ✅ | None |
| Test Plan | ✅ | None |
| Contributors | ✅ | None |
| Screenshots/Videos | ✅ | None |
This PR passes. The submitted risk level matches the label and the body is well-formed.
Last updated: Thu, 02 Jul 2026 16:47:41 GMT
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an intermittent “unsaved edits will be discarded” prompt that could appear after viewing run history (monitoring/read-only) by preventing false isDirty transitions from persisting in the designer Redux state. This aligns with the designer’s contract that monitoring view is read-only and should not create new unsaved-change signals.
Changes:
- Added
monitoringDirtyGuardMiddlewareto revertworkflow.isDirty/workflowParameters.isDirtywhen they transitionfalse → trueduring read-only or monitoring mode. - Wired the new middleware into the designer store middleware chain.
- Added unit tests covering guarded dirty-flag transitions in read-only/monitoring scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| libs/designer/src/lib/core/utils/middleware.ts | Adds a Redux middleware that detects and reverts false-positive dirty-flag transitions in read-only/monitoring mode. |
| libs/designer/src/lib/core/utils/test/middleware.spec.ts | Adds unit tests validating the new middleware’s behavior. |
| libs/designer/src/lib/core/store.ts | Registers the new middleware in the store configuration. |
ebe18b5 to
d131397
Compare
While viewing run history (read-only/monitoring view) the workflow could be falsely marked dirty by side-effects (e.g. a controlled parameter editor re-emitting its value on mount), producing an intermittent 'unsaved edits will be discarded' prompt when toggling back to the workflow/code view even though no edits were made. Add monitoringDirtyGuardMiddleware to the designer-v2 store: while designerOptions.readOnly or isMonitoringView is set, revert any workflow/workflowParameters isDirty false->true transition. Pre-existing dirty state is preserved (only false->true transitions are reverted). Also short-circuit storeStateHistoryMiddleware in read-only/monitoring view so undoable side-effect dispatches (e.g. updateParameterAndDependencies.pending) do not grow undo history or perform compression work for edits the user cannot make. Fixes #9345 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d131397 to
294e1d6
Compare
Contributor
📊 Coverage CheckThe following changed files need attention:
Please add tests for the uncovered files before merging. |
Elaina-Lee
approved these changes
Jul 2, 2026
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.
Commit Type
Risk Level
What & Why
Fixes #9345.
While viewing run history (read-only / monitoring view), the designer could be falsely marked dirty, producing an intermittent "your unsaved edits will be discarded" prompt when toggling back to the workflow/code view — even though the view is read-only and no edits were made.
Root cause: Monitoring view is read-only, but nothing guarded the
isDirtyflags against side-effects. A controlled parameter editor re-emitting its value on mount can trigger a parameter-update path that forcesisUserAction: true→workflow.isDirty = true. Because it depends on parameter content and async timing, it reproduces only "sometimes", and the flag then persists so the host navigation guard shows the discard prompt.Fix: Add
monitoringDirtyGuardMiddlewareto the designer-v2 store. WhiledesignerOptions.readOnlyorisMonitoringViewis set, it reverts anyfalse → truetransition ofworkflow.isDirty/workflowParameters.isDirty. This is root-cause-agnostic (covers parameter, settings, connection, and any other side-effect path) and preserves genuine pre-existing edits — onlyfalse → truetransitions are reverted; already-true flags are left untouched.Impact of Change
monitoringDirtyGuardMiddlewareinlibs/designer-v2/src/lib/core/utils/middleware.ts, wired afterstoreStateHistoryMiddleware. Follows the existing dispatch-from-middleware pattern.Test Plan
libs/designer-v2Vitest suite — 24/24 passing inmiddleware.spec.ts(7 new tests: reverts false→true when readOnly; reverts when isMonitoringView; reverts bothworkflowandworkflowParametersflags; preserves pre-existing true; no revert when editable; no dispatch when unchanged; transparent pass-through tonext). Biome clean on all changed files.Contributors
@rllyy97
Screenshots/Videos
N/A — behavioral fix, no UI changes.