Description
On /tree, the app can render the route error boundary ("Something went wrong! / Show Error") with the error Cannot read properties of undefined (reading 'map').
The error originates in TopBar → OriginSelect (dashboard/src/components/TopBar/TopBar.tsx). pageOrigins is derived from the origins query and only guards !originData, not the case where originData exists without checkout_origins/test_origins:
const pageOrigins = useMemo(() => {
if (!originData) return [];
return isHardwarePath ? originData.test_origins : originData.checkout_origins;
}, [originData, isHardwarePath]);
// ...
pageOrigins.map(...)
The origins query (useOrigins) uses staleTime: 2h and is persisted via PersistQueryClientProvider. When the persisted cache holds an origins entry whose shape lacks those fields, pageOrigins is undefined and .map throws.
Reproduction
Dev server uses sessionStorage (prod uses localStorage).
- Open
/tree.
- In the browser console, seed an
origins cache entry with a mismatched shape and reload:
sessionStorage.setItem('REACT_QUERY_OFFLINE_CACHE', JSON.stringify({
buster: '', timestamp: Date.now(),
clientState: { mutations: [], queries: [{
queryKey: ['origins'], queryHash: '["origins"]',
state: { data: ['maestro'], dataUpdatedAt: Date.now(), dataUpdateCount: 1,
error: null, errorUpdateCount: 0, errorUpdatedAt: 0, fetchFailureCount: 0,
fetchFailureReason: null, fetchMeta: null, isInvalidated: false,
status: 'success', fetchStatus: 'idle' } }] },
}));
location.reload();
/tree shows "Something went wrong! / Show Error"; expanding shows Cannot read properties of undefined (reading 'map').
Recover: sessionStorage.clear() (or localStorage.clear()) then reload.
Description
On
/tree, the app can render the route error boundary ("Something went wrong! / Show Error") with the errorCannot read properties of undefined (reading 'map').The error originates in
TopBar→OriginSelect(dashboard/src/components/TopBar/TopBar.tsx).pageOriginsis derived from theoriginsquery and only guards!originData, not the case whereoriginDataexists withoutcheckout_origins/test_origins:The
originsquery (useOrigins) usesstaleTime: 2hand is persisted viaPersistQueryClientProvider. When the persisted cache holds anoriginsentry whose shape lacks those fields,pageOriginsisundefinedand.mapthrows.Reproduction
Dev server uses
sessionStorage(prod useslocalStorage)./tree.originscache entry with a mismatched shape and reload:/treeshows "Something went wrong! / Show Error"; expanding showsCannot read properties of undefined (reading 'map').Recover:
sessionStorage.clear()(orlocalStorage.clear()) then reload.