File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import { protocolTestSendPayment } from '@/wallets/client/protocols'
24
24
import { timeoutSignal } from '@/lib/time'
25
25
import { WALLET_SEND_PAYMENT_TIMEOUT_MS } from '@/lib/constants'
26
26
import { useToast } from '@/components/toast'
27
+ import { useMe } from '@/components/me'
27
28
28
29
export function useWalletsQuery ( ) {
29
30
const query = useQuery ( WALLETS )
@@ -38,6 +39,8 @@ export function useWalletsQuery () {
38
39
) . then ( wallets => setWallets ( wallets ) )
39
40
} , [ query . data , decryptWallet ] )
40
41
42
+ useRefetchOnChange ( query . refetch )
43
+
41
44
return useMemo ( ( ) => ( {
42
45
...query ,
43
46
// pretend query is still loading until we've decrypted the wallet
@@ -46,6 +49,13 @@ export function useWalletsQuery () {
46
49
} ) , [ query , wallets ] )
47
50
}
48
51
52
+ function useRefetchOnChange ( refetch ) {
53
+ const { me } = useMe ( )
54
+ useEffect ( ( ) => {
55
+ refetch ( )
56
+ } , [ refetch , me ?. privates ?. walletsUpdatedAt ] )
57
+ }
58
+
49
59
export function useWalletQuery ( { id, name } ) {
50
60
const query = useQuery ( WALLET , { variables : { id, name } } )
51
61
const [ wallet , setWallet ] = useState ( null )
You can’t perform that action at this time.
0 commit comments