Commit graph

2 commits

Author SHA1 Message Date
Johannes Millan
19e2cbd63a test(notes): harden #8434 fix per multi-review
Apply verified findings from a multi-agent review of the resize-close fix:

- Guard the navigation listener on `dialogRef.getState() === OPEN`. A
  breakpoint-crossing resize can emit more than one popstate, and
  MatDialogRef.close() does not check its own state — a second call would
  re-run the exit animation and schedule a duplicate close timeout. The
  guard makes the second+ fires no-ops (the saved result still resolves
  once, so this was churn, not data loss).
- Add unit tests asserting the navigation-close actually PERSISTS the
  edit (the point of #8434), both via `changed` when alive and via the
  direct dispatch after a breakpoint switch destroys the host (#8432),
  plus a test that a second popstate while closing does not re-close.
- e2e: hover the notes area before clicking the opacity-hidden
  fullscreen control, matching the real user flow.
- Tighten the duplicated explanatory comment.

No behavior change to the fix itself. 77 inline-markdown unit tests and
the note-resize e2e pass.
2026-06-17 16:07:54 +02:00
Johannes Millan
5966ba5f43 fix(notes): persist fullscreen note when a resize closes the editor (#8434)
The fullscreen markdown editor is a detached CDK overlay opened with
MatDialog's default closeOnNavigation. That maps to the overlay's
disposeOnNavigation, which on any Location change (popstate/hashchange)
disposes the overlay with NO result. Resizing the window across the
mobile layout breakpoint fires such a navigation, so the editor was torn
down and the in-flight note silently dropped.

Open the dialog with closeOnNavigation: false and reinstate close-on-
navigation by subscribing to the same Location signal, but close through
the dialog's save path so the edit is persisted instead of discarded.
This also keeps the Android back-button closing the editor (it routes
through history.back -> popstate) and now saves on that path too.

The listener is not tied to takeUntilDestroyed so it still fires after a
breakpoint switch destroys this host mid-edit; the save then lands via
the existing destroyed-host dispatch (#8432). Torn down in afterClosed.

Covered by inline-markdown unit tests and a new note-resize e2e.
2026-06-17 16:07:53 +02:00