Problem Statement
When creating a new experiment from the UVE Experiments panel (issue #37478, PR #37485), closing the panel triggers an "Unsaved changes" confirmation dialog even when nothing has been typed into the creation form. This gives editors a false "you'll lose your work" warning on a form that has no work to lose, and it will happen on nearly every open-then-close of the panel's creation screen — which is a very common interaction (an editor opening Experiments just to look, with no page-level experiments yet).
Steps to Reproduce
- Enable
FEATURE_FLAG_EXPERIMENTS_PORTLET on the instance.
- In the Universal Visual Editor, open any page that has no existing experiments.
- Click the "A/B" (Experiments) button in the page editor's bottom navigation bar. The panel opens on its empty state.
- Click "Create an Experiment for this Page."
- Without typing anything into any field (leave Experiment Name, Description, everything blank), click the "Close the Experiments panel" (X) button at the top-right of the panel.
Expected: the panel closes immediately — there is nothing to lose.
Actual: an "Unsaved changes" dialog appears: "This experiment has changes that have not been saved. If you leave now they will be lost."
A related repro worth checking as part of the same root cause: typing into the Experiment Name field and, without clicking anything intended to leave or close, the same dialog can appear on its own a moment later.
Suggested root cause (for whoever picks this up)
The "is this dirty?" check driving the dialog looks like it's evaluating something coarser than "has the user changed a field value" — e.g. "is this experiment a Draft that hasn't been persisted to the backend yet" — rather than comparing current field values against their initial (blank) state. That would explain why any close of a not-yet-saved creation screen trips it, edited or not. Worth checking unsaved-changes.guard.ts (added in PR #37485) and whatever dirty-tracking it reads from.
Acceptance Criteria
dotCMS Version
Local build from master @ merge commit 9b5dc65bf8bc1ef26a3d5dfba6bab326043afbc9 (PR #37485). Found during manual post-merge testing of issue #37478.
Severity
High - Major functionality broken (interrupts a very common interaction with a false data-loss warning)
Links
Problem Statement
When creating a new experiment from the UVE Experiments panel (issue #37478, PR #37485), closing the panel triggers an "Unsaved changes" confirmation dialog even when nothing has been typed into the creation form. This gives editors a false "you'll lose your work" warning on a form that has no work to lose, and it will happen on nearly every open-then-close of the panel's creation screen — which is a very common interaction (an editor opening Experiments just to look, with no page-level experiments yet).
Steps to Reproduce
FEATURE_FLAG_EXPERIMENTS_PORTLETon the instance.Expected: the panel closes immediately — there is nothing to lose.
Actual: an "Unsaved changes" dialog appears: "This experiment has changes that have not been saved. If you leave now they will be lost."
A related repro worth checking as part of the same root cause: typing into the Experiment Name field and, without clicking anything intended to leave or close, the same dialog can appear on its own a moment later.
Suggested root cause (for whoever picks this up)
The "is this dirty?" check driving the dialog looks like it's evaluating something coarser than "has the user changed a field value" — e.g. "is this experiment a Draft that hasn't been persisted to the backend yet" — rather than comparing current field values against their initial (blank) state. That would explain why any close of a not-yet-saved creation screen trips it, edited or not. Worth checking
unsaved-changes.guard.ts(added in PR #37485) and whatever dirty-tracking it reads from.Acceptance Criteria
dotCMS Version
Local build from
master@ merge commit9b5dc65bf8bc1ef26a3d5dfba6bab326043afbc9(PR #37485). Found during manual post-merge testing of issue #37478.Severity
High - Major functionality broken (interrupts a very common interaction with a false data-loss warning)
Links