From f6126229eb18a79d2b5cb256b56453ef0d5a4a29 Mon Sep 17 00:00:00 2001 From: Usame Algan <5880855+usame-algan@users.noreply.github.com> Date: Thu, 17 Nov 2022 15:16:37 +0100 Subject: [PATCH] fix: check for pending safe creation in first step (#1190) --- src/components/new-safe/steps/Step0/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/new-safe/steps/Step0/index.tsx b/src/components/new-safe/steps/Step0/index.tsx index 94030e21a3..8f58ccc0f2 100644 --- a/src/components/new-safe/steps/Step0/index.tsx +++ b/src/components/new-safe/steps/Step0/index.tsx @@ -10,18 +10,21 @@ import WalletDetails from '@/components/common/ConnectWallet/WalletDetails' import PairingDetails from '@/components/common/PairingDetails' import useSyncSafeCreationStep from '@/components/new-safe/CreateSafe/useSyncSafeCreationStep' import layoutCss from '@/components/new-safe/CreateSafe/styles.module.css' +import useLocalStorage from '@/services/local-storage/useLocalStorage' +import { type PendingSafeData, SAFE_PENDING_CREATION_STORAGE_KEY } from '@/components/new-safe/steps/Step4' const CreateSafeStep0 = ({ onSubmit, setStep }: StepRenderProps) => { + const [pendingSafe] = useLocalStorage(SAFE_PENDING_CREATION_STORAGE_KEY) const wallet = useWallet() const chain = useCurrentChain() const isSupported = isPairingSupported(chain?.disabledWallets) useSyncSafeCreationStep(setStep) useEffect(() => { - if (!wallet) return + if (!wallet || pendingSafe) return onSubmit({ owners: [{ address: wallet.address, name: wallet.ens || '' }] }) - }, [onSubmit, wallet]) + }, [onSubmit, wallet, pendingSafe]) return ( <>