Skip to content

Commit

Permalink
fix: check for pending safe creation in first step (#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan authored Nov 17, 2022
1 parent 5e7bedd commit f612622
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/new-safe/steps/Step0/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<NewSafeFormData>) => {
const [pendingSafe] = useLocalStorage<PendingSafeData | undefined>(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 (
<>
Expand Down

0 comments on commit f612622

Please sign in to comment.