@dynamic-labs/wagmi-connector 0.19.0-alpha.4 → 0.19.0-alpha.5

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ## [0.19.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.4...v0.19.0-alpha.5) (2023-08-24)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * send wagmi settings only once when DynamicWagmiConnector loads ([#3103](https://github.com/dynamic-labs/DynamicAuth/issues/3103)) ([8bba505](https://github.com/dynamic-labs/DynamicAuth/commit/8bba505f84f6f3567743397a3f1274a3840a7700))
8
+
2
9
  ## [0.19.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.3...v0.19.0-alpha.4) (2023-08-23)
3
10
 
4
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wagmi-connector",
3
- "version": "0.19.0-alpha.4",
3
+ "version": "0.19.0-alpha.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -11,8 +11,8 @@
11
11
  "react": "^17.0.2 || ^18.0.0",
12
12
  "ethers": "5.7.2",
13
13
  "wagmi": "~0.12.13",
14
- "@dynamic-labs/sdk-react-core": "0.19.0-alpha.4",
15
- "@dynamic-labs/types": "0.19.0-alpha.4",
14
+ "@dynamic-labs/sdk-react-core": "0.19.0-alpha.5",
15
+ "@dynamic-labs/types": "0.19.0-alpha.5",
16
16
  "eventemitter3": "5.0.1"
17
17
  },
18
18
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import { configureChains, mainnet, createClient, WagmiConfig } from 'wagmi';
3
3
  import { publicProvider } from 'wagmi/providers/public';
4
4
  import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
@@ -21,9 +21,13 @@ const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, child
21
21
  var _a;
22
22
  const { networkConfigurations, handleLogOut, connectedWallets, linkedWallets, authMode, sendWagmiSettings, } = useDynamicContext();
23
23
  const wallets = authMode === 'connect-only' ? connectedWallets : linkedWallets;
24
- sendWagmiSettings({
25
- dynamicWagmiSettings: customerSuppliedEvmNetworks,
26
- });
24
+ useEffect(() => {
25
+ // only send wagmi settings once, when the first time DynamicWagmiConnector renders
26
+ sendWagmiSettings({
27
+ dynamicWagmiSettings: customerSuppliedEvmNetworks,
28
+ });
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30
+ }, []);
27
31
  const evmNetworks = ((_a = customerSuppliedEvmNetworks !== null && customerSuppliedEvmNetworks !== void 0 ? customerSuppliedEvmNetworks : networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm) !== null && _a !== void 0 ? _a : []).map((network) => {
28
32
  network.chainId = parseInt(network.chainId.toString());
29
33
  return network;