@bze/bze-ui-kit 1.0.10 → 1.0.12

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.mjs CHANGED
@@ -3355,21 +3355,27 @@ var useSigningClient = ({ chainName }) => {
3355
3355
  const { getSigningClient, signingClientError, wallet, chain } = useChain(chainName != null ? chainName : getChainName());
3356
3356
  const [signingClient, setSigningClient] = useState(null);
3357
3357
  const [isSigningClientReady, setIsSigningClientReady] = useState(false);
3358
- const hasInitialized = useRef(false);
3358
+ const initializedForWallet = useRef(null);
3359
3359
  const createSigningClient = useCallback2(async () => {
3360
3360
  return getSigningClient();
3361
3361
  }, [getSigningClient]);
3362
3362
  useEffect(() => {
3363
- if (!wallet || !chain || hasInitialized.current) {
3363
+ if (!wallet || !chain) {
3364
+ if (initializedForWallet.current !== null) {
3365
+ setSigningClient(null);
3366
+ setIsSigningClientReady(false);
3367
+ initializedForWallet.current = null;
3368
+ }
3364
3369
  return;
3365
3370
  }
3371
+ if (initializedForWallet.current === wallet) return;
3366
3372
  const load = async () => {
3367
3373
  const client = await createSigningClient();
3368
3374
  if (client) {
3369
3375
  registerBzeEncoders(client);
3370
3376
  setSigningClient(client);
3371
3377
  setIsSigningClientReady(true);
3372
- hasInitialized.current = true;
3378
+ initializedForWallet.current = wallet;
3373
3379
  }
3374
3380
  };
3375
3381
  load();