Skip to content

Commit ea153f9

Browse files
authored
fix(wallet-mobile): offline crashes (#3664)
1 parent 0432939 commit ea153f9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

apps/wallet-mobile/src/features/WalletManager/common/hooks/useBestBlock.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ export const useBestBlock = ({options}: {options?: UseQueryOptions<Chain.Cardano
1111
retry: 3,
1212
retryDelay: 1_000,
1313
queryKey: [network, 'tipStatus'],
14-
queryFn: () => networkManager.api.bestBlock(),
14+
queryFn: () =>
15+
networkManager.api.bestBlock().catch(() => ({
16+
// TODO: Without this it break when offline. Needs better fixing
17+
epoch: 510,
18+
slot: 130081,
19+
globalSlot: 135086881,
20+
hash: 'ab0093eb78bcb0146355741388632eb50c69407df8fa32de85e5f198d725e8f4',
21+
height: 10850697,
22+
})),
1523
...options,
1624
})
1725

apps/wallet-mobile/src/yoroi-wallets/hooks/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ export const useFrontendFees = (
440440
suspense: true,
441441
queryKey: [wallet.id, 'frontend-fees'],
442442
...options,
443-
queryFn: () => wallet.api.getFrontendFees(),
443+
queryFn: () =>
444+
wallet.api.getFrontendFees().catch(() => ({
445+
// TODO: Without this it break when offline. Needs better fixing
446+
})),
444447
})
445448

446449
return {

0 commit comments

Comments
 (0)