@orderly.network/wallet-connector-privy 2.8.3 → 2.8.4

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/dist/index.js CHANGED
@@ -3278,6 +3278,10 @@ function WalletConnectorPrivyProvider(props) {
3278
3278
  );
3279
3279
  const fetchMainChains = hooks.useMainnetChainsStore((state) => state.fetchData);
3280
3280
  const fetchTestChains = hooks.useTestnetChainsStore((state) => state.fetchData);
3281
+ const mainnetChainsHydrated = hooks.useMainnetChainsStore(
3282
+ (state) => state.hydrated
3283
+ );
3284
+ const testChainsHydrated = hooks.useTestnetChainsStore((state) => state.hydrated);
3281
3285
  const mainnetChainInfosFromStore = hooks.useMainnetChainsStore(
3282
3286
  (state) => state.data
3283
3287
  );
@@ -3339,13 +3343,18 @@ function WalletConnectorPrivyProvider(props) {
3339
3343
  fetchSwapData();
3340
3344
  }, [props.enableSwapDeposit, props.customChains]);
3341
3345
  React19.useEffect(() => {
3346
+ if (!mainnetChainsHydrated || !testChainsHydrated)
3347
+ return;
3348
+ if (Array.isArray(hooks.useMainnetChainsStore.getState().data) && hooks.useTestnetChainsStore.getState().data) {
3349
+ return;
3350
+ }
3342
3351
  fetchMainChains().then((data) => {
3343
3352
  setMainnetChainInfos(data);
3344
3353
  });
3345
3354
  fetchTestChains().then((data) => {
3346
3355
  setTestChainInfos(data);
3347
3356
  });
3348
- }, []);
3357
+ }, [mainnetChainsHydrated, testChainsHydrated]);
3349
3358
  const handleCustomerChains = () => {
3350
3359
  const testChains = processChainInfo(
3351
3360
  props.customChains.testnet?.map((item) => item.network_infos)