From 09cad6f8bc952f8764655756af37d80a1eb86109 Mon Sep 17 00:00:00 2001 From: iamacook Date: Thu, 23 Nov 2023 11:42:12 +0100 Subject: [PATCH] fix: set flow, improve comment + remove caching --- src/components/settings/Recovery/DelayModifierRow.tsx | 4 ++-- src/components/settings/Recovery/index.tsx | 2 +- src/components/tx-flow/flows/UpsertRecovery/index.tsx | 10 +++++----- src/services/recovery/setup.ts | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/settings/Recovery/DelayModifierRow.tsx b/src/components/settings/Recovery/DelayModifierRow.tsx index 2a653a75eb..b241bfcfca 100644 --- a/src/components/settings/Recovery/DelayModifierRow.tsx +++ b/src/components/settings/Recovery/DelayModifierRow.tsx @@ -8,6 +8,7 @@ import DeleteIcon from '@/public/images/common/delete.svg' import EditIcon from '@/public/images/common/edit.svg' import CheckWallet from '@/components/common/CheckWallet' import { ConfirmRemoveRecoveryModal } from './ConfirmRemoveRecoveryModal' +import { UpsertRecoveryFlow } from '@/components/tx-flow/flows/UpsertRecovery' import type { RecoveryState } from '@/store/recoverySlice' export function DelayModifierRow({ delayModifier }: { delayModifier: RecoveryState[number] }): ReactElement | null { @@ -20,8 +21,7 @@ export function DelayModifierRow({ delayModifier }: { delayModifier: RecoverySta } const onEdit = () => { - // TODO: Display flow - setTxFlow(undefined) + setTxFlow() } const onDelete = () => { diff --git a/src/components/settings/Recovery/index.tsx b/src/components/settings/Recovery/index.tsx index e612b156d3..e31899b837 100644 --- a/src/components/settings/Recovery/index.tsx +++ b/src/components/settings/Recovery/index.tsx @@ -67,7 +67,7 @@ const headCells = [ { id: HeadCells.Actions, label: '', sticky: true }, ] -// TODO: Migrate section +// TODO: Combine section with spending limits under "Security & Login" as per design export function Recovery(): ReactElement { const { setTxFlow } = useContext(TxModalContext) const recovery = useAppSelector(selectRecovery) diff --git a/src/components/tx-flow/flows/UpsertRecovery/index.tsx b/src/components/tx-flow/flows/UpsertRecovery/index.tsx index ba5cb0b0b6..89ea1c79d2 100644 --- a/src/components/tx-flow/flows/UpsertRecovery/index.tsx +++ b/src/components/tx-flow/flows/UpsertRecovery/index.tsx @@ -25,18 +25,18 @@ export type UpsertRecoveryFlowProps = { [UpsertRecoveryFlowFields.emailAddress]: string } -export function UpsertRecoveryFlow({ recovery }: { recovery?: RecoveryState[number] }): ReactElement { +export function UpsertRecoveryFlow({ delayModifier }: { delayModifier?: RecoveryState[number] }): ReactElement { const { data, step, nextStep, prevStep } = useTxStepper({ - [UpsertRecoveryFlowFields.guardian]: recovery?.guardians?.[0] ?? '', - [UpsertRecoveryFlowFields.txCooldown]: recovery?.txCooldown?.toString() ?? `${DAY_IN_SECONDS * 28}`, // 28 days in seconds - [UpsertRecoveryFlowFields.txExpiration]: recovery?.txExpiration?.toString() ?? '0', + [UpsertRecoveryFlowFields.guardian]: delayModifier?.guardians?.[0] ?? '', + [UpsertRecoveryFlowFields.txCooldown]: delayModifier?.txCooldown?.toString() ?? `${DAY_IN_SECONDS * 28}`, // 28 days in seconds + [UpsertRecoveryFlowFields.txExpiration]: delayModifier?.txExpiration?.toString() ?? '0', [UpsertRecoveryFlowFields.emailAddress]: '', }) const steps = [ nextStep(data)} />, nextStep({ ...data, ...formData })} />, - , + , ] const isIntro = step === 0 diff --git a/src/services/recovery/setup.ts b/src/services/recovery/setup.ts index 27b35e5174..936a9abada 100644 --- a/src/services/recovery/setup.ts +++ b/src/services/recovery/setup.ts @@ -140,8 +140,7 @@ export async function _getEditRecoveryTransactions({ const enableModule = delayModifierContract.interface.encodeFunctionData('enableModule', [guardianToAdd]) txData.push(enableModule) - // Add guardian to cache - _guardians.push(guardianToAdd) + // Need not add guardian to cache as not relevant for prevModule } for (const guardianToRemove of guardiansToRemove) {