Skip to content

Commit

Permalink
Merge pull request LedgerHQ#4824 from LedgerHQ/bugfix/protect-2538-pr…
Browse files Browse the repository at this point in the history
…evious-error-pairing

fix:(protect-2538): previous cta redirect to disclaimer screen
  • Loading branch information
stephane-lieumont-ledger authored Sep 25, 2023
2 parents 4491d8e + 96e146a commit 38bb6d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-cups-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

on previous cta recover onboarding, the app redirect to disclaimer screen
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useCallback, useContext, useEffect, useRef, useState } from "react";
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { useSelector } from "react-redux";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
Expand All @@ -25,12 +26,16 @@ import { useDynamicUrl } from "~/renderer/terms";
const RecoverRestore = () => {
const { t } = useTranslation();
const history = useHistory();
const recoverFF = useFeature("protectServicesDesktop");
const currentDevice = useSelector(getCurrentDevice);
const [state, setState] = useState<OnboardingState>();
const [error, setError] = useState<Error>();
const { setDeviceModelId } = useContext(OnboardingContext);
const buyNew = useDynamicUrl("buyNew");
const sub = useRef<Subscription>();
const recoverDiscoverPath = useMemo(() => {
return `/recover/${recoverFF?.params?.protectId}?redirectTo=disclaimerRestore`;
}, [recoverFF?.params?.protectId]);

const getOnboardingState = useCallback((device: Device) => {
sub.current?.unsubscribe();
Expand Down Expand Up @@ -116,7 +121,7 @@ const RecoverRestore = () => {
return (
<Flex width="100%" height="100%" position="relative">
<Flex position="relative" height="100%" width="100%" flexDirection="column">
<OnboardingNavHeader onClickPrevious={() => history.push("/onboarding/select-device")} />
<OnboardingNavHeader onClickPrevious={() => history.push(recoverDiscoverPath)} />
{renderError({
t,
error: new DeviceAlreadySetup("", { device: currentDevice?.modelId ?? "device" }),
Expand Down

0 comments on commit 38bb6d2

Please sign in to comment.