Skip to content

fix(portal): resolve destination-types loading race that blanks the page#914

Merged
alexluong merged 2 commits into
mainfrom
alex/portal-destination-types-loading-race
May 27, 2026
Merged

fix(portal): resolve destination-types loading race that blanks the page#914
alexluong merged 2 commits into
mainfrom
alex/portal-destination-types-loading-race

Conversation

@alexluong
Copy link
Copy Markdown
Collaborator

useDestinationTypes returned {} while the SWR fetch was pending. Empty object is truthy, so callers' destination_types && destinations gates passed before the types had loaded — and when /destinations resolved before /destination-types, the list view crashed in render on destination_types[destination.type].icon. ErrorBoundary blanked the route, requiring several reloads (SWR cache warm-up) for the page to render. Return undefined while loading so the existing gates actually mean "everything loaded".

alexluong added 2 commits May 27, 2026 20:39
useDestinationTypes returned `{}` while the SWR fetch was pending,
which is truthy. Callers' `destination_types && destinations` gates
therefore passed before destination-types had loaded, and the list
view crashed in render on `destination_types[destination.type].icon`
when /destinations resolved before /destination-types. ErrorBoundary
caught the crash and blanked the route, requiring several reloads
(SWR cache warm-up) for the page to render.

Return `undefined` while loading so the existing truthy gates
actually mean "everything loaded". Update the two call sites that
indexed the map (`useDestinationType`, `CreateDestination`'s context)
to handle the new nullable return.
@alexluong alexluong merged commit 789a74f into main May 27, 2026
2 checks passed
@alexluong alexluong deleted the alex/portal-destination-types-loading-race branch May 27, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants