fix(frontend): stop empty persist retries, survive disabled storage and show remote project loading

The drop-oldest retryer returns undefined once no query is left, ending the sync persister's retry loop. A throwing localStorage getter yields no persister instead of a crash. useSessionsAcrossDirectories reports isPending under the same condition it enables the query. RemoteProject renders a loader while the server list restores instead of a blank body.
This commit is contained in:
Chris Scott committed 2026-10-24 19:24:26 -04:00
1 parent ae461a7b16
commit a1f1212082
6 files changed
+58 -6

No files matched your search

+3
View File
@@ -183,10 +183,13 @@ describe('useSessionsAcrossDirectories', () => {
{ wrapper: createWrapper(queryClient) },
)
expect(result.current.isPending).toBe(true)
await waitFor(() => {
expect(result.current.isLoading).toBe(false)
})
expect(result.current.isPending).toBe(false)
expect(mocks.listSessionPage).toHaveBeenCalledWith({
limit: 25,
order: 'desc',
+3 -2
View File
@@ -90,6 +90,7 @@ export const useSessionsAcrossDirectories = (
const persistedGcTime = normalizedSearch === undefined ? PERSISTED_CACHE_MAX_AGE_MS : undefined;
const directoryKey = uniqueDirectories.join('|');
const childSessionsParam = includeChildren ? { includeChildren: true } : {};
const isQueryEnabled = uniqueDirectories.length > 0 || allDirectories;
const query = useInfiniteQuery<
SessionListPage,
@@ -183,7 +184,7 @@ export const useSessionsAcrossDirectories = (
}
: undefined,
getNextPageParam: (lastPage) => lastPage.nextParam,
enabled: uniqueDirectories.length > 0 || allDirectories,
enabled: isQueryEnabled,
staleTime: 10000,
gcTime: persistedGcTime,
refetchOnWindowFocus: true,
@@ -198,7 +199,7 @@ export const useSessionsAcrossDirectories = (
return {
data,
isLoading: query.isLoading,
isPending: query.isPending && uniqueDirectories.length > 0,
isPending: query.isPending && isQueryEnabled,
isPlaceholderData: query.isPlaceholderData,
isError: query.isError,
fetchNextPage: query.fetchNextPage,