wagmi 0.10.5 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +9 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -747,7 +747,7 @@ function useNetwork() {
747
747
  }
748
748
 
749
749
  // src/hooks/accounts/useSigner.ts
750
- import { fetchSigner } from "@wagmi/core";
750
+ import { fetchSigner, watchSigner } from "@wagmi/core";
751
751
  import * as React10 from "react";
752
752
  function queryKey4({ chainId }) {
753
753
  return [{ entity: "signer", chainId, persist: false }];
@@ -777,11 +777,14 @@ function useSigner({
777
777
  });
778
778
  const queryClient = useQueryClient2();
779
779
  React10.useEffect(() => {
780
- if (connector)
781
- signerQuery.refetch();
782
- else
783
- queryClient.removeQueries(queryKey4({ chainId }));
784
- }, [connector]);
780
+ const unwatch = watchSigner({ chainId }, (signer) => {
781
+ if (signer)
782
+ queryClient.invalidateQueries(queryKey4({ chainId }));
783
+ else
784
+ queryClient.removeQueries(queryKey4({ chainId }));
785
+ });
786
+ return unwatch;
787
+ }, [queryClient, chainId]);
785
788
  return signerQuery;
786
789
  }
787
790
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "wagmi",
3
3
  "description": "React Hooks for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.10.5",
5
+ "version": "0.10.7",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",
@@ -106,7 +106,7 @@
106
106
  "@walletconnect/ethereum-provider": "^1.8.0",
107
107
  "abitype": "^0.2.5",
108
108
  "use-sync-external-store": "^1.2.0",
109
- "@wagmi/core": "0.8.11"
109
+ "@wagmi/core": "0.8.12"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@testing-library/react": "^13.3.0",