fix(detail): capture guard fields before await to close re-entrancy window in OnParametersSetAsync

This commit is contained in:
daniel-c-harvey
2026-06-15 12:55:15 -04:00
parent f02f370ed9
commit 7d23c0654b
2 changed files with 15 additions and 5 deletions
@@ -39,6 +39,14 @@ public abstract class ReleaseDetailBase : ComponentBase, IDisposable
// OnInitialized (which fires once per instance).
if (_loaded && _loadedId == Id) return;
// Capture the id synchronously before any await so that a re-entrant call
// (rapid navigation or a re-render that changes Id while Load is in flight)
// sees the correct guard state. Without this, a second OnParametersSetAsync
// for the same Id would bypass the guard above and start a second Load,
// causing two ViewModel.Load calls to race on the single scoped instance.
_loadedId = Id;
_loaded = true;
// The bridged payload carries both the release and its resolved track so the interactive
// pass renders identically without a second round-trip. Guard on the id: a payload for a
// different release must not seed this page (stale-bridge bleed across navigation).
@@ -52,9 +60,6 @@ public abstract class ReleaseDetailBase : ComponentBase, IDisposable
{
await ViewModel.Load(Id);
}
_loadedId = Id;
_loaded = true;
}
private Task Persist()