UNPKG

@ledgerhq/live-common

Version:
20 lines 555 B
import { useMemo } from "react"; import { useBridgeSyncState } from "./context"; export function useGlobalSyncState() { const syncState = useBridgeSyncState(); let pending = false; let error = null; for (const k in syncState) { const s = syncState[k]; if (s.error) error = s.error; if (s.pending) pending = true; } const globalState = useMemo(() => ({ pending, error, }), [pending, error]); return globalState; } //# sourceMappingURL=useGlobalSyncState.js.map