Live wall review fixes: no not-found flash or map whiplash when the selected incident resolves (#239)
useIncident reports loading until its answer belongs to the current id (the render before the effect read the previous id's loading=false), and clears a stale doc on a denied read. LiveView holds the last selected doc for the same id while the by-id lookup is pending, so a watched incident resolving no longer deselects (fly to region) and reselects (fly back). Follow-up for the panel's 'active'/elapsed copy on resolved incidents: #275. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a267fdf982
commit
7a0e86decf
@@ -284,9 +284,15 @@ export function LiveView() {
|
||||
lookupId && lookedUp && lookedUp.incident_id === lookupId && !!orgId && (lookedUp as IncidentDoc).org_id === orgId
|
||||
? lookedUp
|
||||
: null;
|
||||
const selected: IncidentDoc | null = activeSelected ?? fetchedSelected;
|
||||
const lookupPending = !!lookupId && !fetchedSelected && (lookupLoading || !orgId);
|
||||
const notFound = !!lookupId && !fetchedSelected && !lookupPending;
|
||||
// The incident on screen resolving drops it from the active list before its
|
||||
// by-id lookup lands. Hold the last doc for that same id meanwhile, so the
|
||||
// wall doesn't fly back to the region and straight back again.
|
||||
const lastSelected = useRef<IncidentDoc | null>(null);
|
||||
const held = lookupPending && lastSelected.current?.incident_id === link.inc ? lastSelected.current : null;
|
||||
const selected: IncidentDoc | null = activeSelected ?? fetchedSelected ?? held;
|
||||
lastSelected.current = selected;
|
||||
const resolvedSelected = fetchedSelected?.status === "resolved" ? fetchedSelected : null;
|
||||
|
||||
// The selected incident's own calls, by incident id — no limit, so a long
|
||||
|
||||
Reference in New Issue
Block a user