mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Update use-is-subplebbit-offline.ts
This commit is contained in:
@@ -21,9 +21,13 @@ const useIsSubplebbitOffline = (subplebbit: Subplebbit) => {
|
|||||||
}
|
}
|
||||||
}, [address, state, updatedAt, updatingState, setSubplebbitOfflineState]);
|
}, [address, state, updatedAt, updatingState, setSubplebbitOfflineState]);
|
||||||
|
|
||||||
const subplebbitData = subplebbitOfflineState[address] || { initialLoad: true };
|
const subplebbitOfflineStore = subplebbitOfflineState[address] || { initialLoad: true };
|
||||||
|
|
||||||
|
const isLoading =
|
||||||
|
updatingState === 'resolving-address' ||
|
||||||
|
(updatingState === 'stopped' && state === 'stopped' && !updatedAt) ||
|
||||||
|
(subplebbitOfflineStore.initialLoad && updatingState === 'fetching-ipns' && !updatedAt);
|
||||||
|
|
||||||
const isLoading = (updatingState === 'resolving-address' && state !== 'stopped') || (subplebbitData.initialLoad && updatingState === 'fetching-ipns' && !updatedAt);
|
|
||||||
const isOffline =
|
const isOffline =
|
||||||
!isLoading && ((updatedAt && updatedAt < Date.now() / 1000 - 60 * 60) || updatingState === 'failed' || (updatingState === 'fetching-ipns' && !updatedAt));
|
!isLoading && ((updatedAt && updatedAt < Date.now() / 1000 - 60 * 60) || updatingState === 'failed' || (updatingState === 'fetching-ipns' && !updatedAt));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user