Fixes the navigation regression after saving a remote Jellyfin/Emby connection. Successful saves now clean the dirty guard synchronously before triggering navigation, so the SPA no longer treats completed work as unsaved.
Root cause
RemoteConnectionEditScreen queued its React baseline updates and dispatched synthetic popstate in the same save callback. useDirtyGuard only mirrored dirty into its ref after render/effect, so App observed stale dirty=true and could prompt/veto the successful navigation.
Audit
The only other useDirtyGuard callers—path replacements and remote libraries—remain mounted after saving and do not navigate in the same callback. Both already gate draft mutations while saving.
Change
useDirtyGuard returns a stable markClean callback.
Connection save calls it only after durable server success and immediately before navigateToPath, while still queuing the real clean baseline.
Address/API-key mutations are disabled and guarded while the save owns the current draft, preventing a slow completion from discarding newer edits.
SPA conventions document both the narrow event-boundary rule and its request-ownership requirement.
A real App-level regression proves the editor unmounts and the source screen mounts without a dirty prompt.
Verification
Negative control: the Jellyfin + Emby regression failed before the guard fix.
Focused: 118/118 tests passed.
Full web: 83 files / 742 tests passed.
lint, typecheck, production build, check:api, and git diff --check passed.
.NET solution build: succeeded with 0 warnings / 0 errors.
Pre-push check:api, lint, typecheck, and production build passed.
Cold exact-head re-review: no findings, MERGEABLE @ b9305fdee99d05209c1db6ebc48deb264e19680b.
Live browser E2E on a fresh built host: authenticated through the real boot gate; initial Jellyfin connect and subsequent saved-connection edit each returned HTTP 200; each round-tripped through GET /api/v1/media-sources/jellyfin; the source screen mounted and editor unmounted; zero dirty dialogs, console errors, or runtime exceptions. A local Jellyfin-compatible stub supplied only /System/Info and /Library/VirtualFolders.
## Summary
Fixes the navigation regression after saving a remote Jellyfin/Emby connection. Successful saves now clean the dirty guard synchronously before triggering navigation, so the SPA no longer treats completed work as unsaved.
## Root cause
`RemoteConnectionEditScreen` queued its React baseline updates and dispatched synthetic `popstate` in the same save callback. `useDirtyGuard` only mirrored `dirty` into its ref after render/effect, so App observed stale `dirty=true` and could prompt/veto the successful navigation.
## Audit
The only other `useDirtyGuard` callers—path replacements and remote libraries—remain mounted after saving and do not navigate in the same callback. Both already gate draft mutations while saving.
## Change
- `useDirtyGuard` returns a stable `markClean` callback.
- Connection save calls it only after durable server success and immediately before `navigateToPath`, while still queuing the real clean baseline.
- Address/API-key mutations are disabled and guarded while the save owns the current draft, preventing a slow completion from discarding newer edits.
- SPA conventions document both the narrow event-boundary rule and its request-ownership requirement.
- A real App-level regression proves the editor unmounts and the source screen mounts without a dirty prompt.
## Verification
- Negative control: the Jellyfin + Emby regression failed before the guard fix.
- Focused: 118/118 tests passed.
- Full web: 83 files / 742 tests passed.
- lint, typecheck, production build, check:api, and `git diff --check` passed.
- .NET solution build: succeeded with 0 warnings / 0 errors.
- Pre-push check:api, lint, typecheck, and production build passed.
- Cold exact-head re-review: no findings, `MERGEABLE @ b9305fdee99d05209c1db6ebc48deb264e19680b`.
- Live browser E2E on a fresh built host: authenticated through the real boot gate; initial Jellyfin connect and subsequent saved-connection edit each returned HTTP 200; each round-tripped through `GET /api/v1/media-sources/jellyfin`; the source screen mounted and editor unmounted; zero dirty dialogs, console errors, or runtime exceptions. A local Jellyfin-compatible stub supplied only `/System/Info` and `/Library/VirtualFolders`.
Fixes #344
Disable and gate remote connection draft inputs while a save owns the current revision. Exercise the real App-owned route transition after a successful save so the regression proves the editor unmounts without a dirty prompt.
Refs #344
Co-Authored-By: OpenAI Codex <codex@openai.com>
Cold exact-head re-review found no issues. Both earlier blockers are closed; focused App/remote-connection tests pass 118/118.
Review-verdict: MERGEABLE @ b9305fdee99d05209c1db6ebc48deb264e19680b
Cold exact-head re-review found no issues. Both earlier blockers are closed; focused App/remote-connection tests pass 118/118.
timothy
merged commit ffb3e6d5e1 into main2026-07-14 08:02:35 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Fixes the navigation regression after saving a remote Jellyfin/Emby connection. Successful saves now clean the dirty guard synchronously before triggering navigation, so the SPA no longer treats completed work as unsaved.
Root cause
RemoteConnectionEditScreenqueued its React baseline updates and dispatched syntheticpopstatein the same save callback.useDirtyGuardonly mirroreddirtyinto its ref after render/effect, so App observed staledirty=trueand could prompt/veto the successful navigation.Audit
The only other
useDirtyGuardcallers—path replacements and remote libraries—remain mounted after saving and do not navigate in the same callback. Both already gate draft mutations while saving.Change
useDirtyGuardreturns a stablemarkCleancallback.navigateToPath, while still queuing the real clean baseline.Verification
git diff --checkpassed.MERGEABLE @ b9305fdee99d05209c1db6ebc48deb264e19680b.GET /api/v1/media-sources/jellyfin; the source screen mounted and editor unmounted; zero dirty dialogs, console errors, or runtime exceptions. A local Jellyfin-compatible stub supplied only/System/Infoand/Library/VirtualFolders.Fixes #344
Review-verdict: MERGEABLE @
b9305fdee9Cold exact-head re-review found no issues. Both earlier blockers are closed; focused App/remote-connection tests pass 118/118.