From 4dab00ae486fc84d67086001d156e6186fa0eb5f Mon Sep 17 00:00:00 2001 From: Taksh Date: Wed, 22 Jul 2026 14:02:08 +0300 Subject: [PATCH] keep imported key when backing out of harness setup Signed-off-by: Taksh --- desktop/src/features/onboarding/ui/MachineOnboardingFlow.tsx | 3 +++ desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop/src/features/onboarding/ui/MachineOnboardingFlow.tsx b/desktop/src/features/onboarding/ui/MachineOnboardingFlow.tsx index 89c284f237..1810221998 100644 --- a/desktop/src/features/onboarding/ui/MachineOnboardingFlow.tsx +++ b/desktop/src/features/onboarding/ui/MachineOnboardingFlow.tsx @@ -47,6 +47,7 @@ export function MachineOnboardingFlow({ const [error, setError] = React.useState(null); const [isPending, setIsPending] = React.useState(false); const [identityWasImported, setIdentityWasImported] = React.useState(false); + const [importedNsec, setImportedNsec] = React.useState(""); const [selectedPubkey, setSelectedPubkey] = React.useState( null, ); @@ -103,6 +104,7 @@ export function MachineOnboardingFlow({ continueWithIdentity(identity.pubkey); queryClient.setQueryData(["identity"], identity); setIdentityWasImported(true); + setImportedNsec(nsec); setSelectedPubkey(identity.pubkey); setPage("setup"); }, @@ -193,6 +195,7 @@ export function MachineOnboardingFlow({
void replaceLostIdentity() diff --git a/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx b/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx index daa3f007e9..70de2eb485 100644 --- a/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx +++ b/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx @@ -16,6 +16,8 @@ type NostrKeyImportFormProps = { backLabel?: string; disabled?: boolean; errorMessage?: string | null; + /** Prefill when remounting after navigating away (e.g. back from harness setup). */ + initialNsec?: string; onBack: () => void; onImport: (nsec: string) => Promise; /** "spotlight" is the first-launch treatment: glowy centered input, no drop zone, pill buttons. */ @@ -33,11 +35,12 @@ export function NostrKeyImportForm({ backLabel = "Back", disabled = false, errorMessage: externalErrorMessage = null, + initialNsec = "", onBack, onImport, variant = "default", }: NostrKeyImportFormProps) { - const [nsecInput, setNsecInput] = React.useState(""); + const [nsecInput, setNsecInput] = React.useState(initialNsec); const [isImporting, setIsImporting] = React.useState(false); const [importError, setImportError] = React.useState(null); const [isDragging, setIsDragging] = React.useState(false);