From 645ff7836523500dd717dcda381c009861654237 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Wed, 3 Jul 2024 18:55:15 +0200 Subject: [PATCH] Fix server config not updated after save or detach --- components/wallet/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/wallet/index.js b/components/wallet/index.js index 80573dc1..f2a71052 100644 --- a/components/wallet/index.js +++ b/components/wallet/index.js @@ -142,7 +142,7 @@ function useServerConfig (wallet) { const client = useApolloClient() const me = useMe() - const { data } = useQuery(WALLET_BY_TYPE, { variables: { type: wallet?.server?.walletType }, skip: !wallet?.server }) + const { data, refetch: refetchConfig } = useQuery(WALLET_BY_TYPE, { variables: { type: wallet?.server?.walletType }, skip: !wallet?.server }) const walletId = data?.walletByType?.id const serverConfig = { id: walletId, priority: data?.walletByType?.priority, ...data?.walletByType?.wallet } @@ -170,14 +170,16 @@ function useServerConfig (wallet) { }) } finally { client.refetchQueries({ include: ['WalletLogs'] }) + refetchConfig() } }, [client, walletId]) const clearConfig = useCallback(async () => { - return await client.mutate({ + await client.mutate({ mutation: REMOVE_WALLET, variables: { id: walletId } }) + refetchConfig() }, [client, walletId]) return [config, saveConfig, clearConfig]