mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix(frontend): show servers unavailable when the initial server fetch is paused offline
A paused initial fetch kept showsInitialLoading true, so the remote project page showed a spinner until connectivity returned. The hook now exposes isPaused and excludes paused fetches from initial loading; the project page, project list and sidebar show an offline card with Retry instead of a missing-server state, while cached server data still wins.
This commit is contained in:
1 parent
a1f1212082
commit
52b38053b9
9 files changed
+246
-8
No files matched your search
@@ -57,12 +57,18 @@ export function useOpenCodeServers(options: { enabled?: boolean } = {}) {
|
||||
})
|
||||
|
||||
const serversListState = cachedListStates(serversQuery.data, serversQuery.isError)
|
||||
const isPaused = serversQuery.fetchStatus === 'paused'
|
||||
|
||||
return {
|
||||
servers: serversQuery.data ?? [],
|
||||
isLoading: serversQuery.isLoading,
|
||||
/** True only while no server list is cached and no error settled, so a restore is not read as a missing server. */
|
||||
showsInitialLoading: serversListState.showsInitialLoading,
|
||||
/**
|
||||
* True only while no server list is cached, no error settled and the fetch is not paused, so a
|
||||
* restore is not read as a missing server and an offline pause is not read as a load.
|
||||
*/
|
||||
showsInitialLoading: serversListState.showsInitialLoading && !isPaused,
|
||||
/** True while TanStack Query holds the server list fetch because the browser is offline. */
|
||||
isPaused,
|
||||
isSuccess: serversQuery.isSuccess,
|
||||
error: serversQuery.error,
|
||||
refetch: serversQuery.refetch,
|
||||
|
||||
Reference in new issue
Block a user