Skip to content

Commit

Permalink
Revert "Merge pull request #8724 from LedgerHQ/bugfix/ls-LIVE-15094" (#…
Browse files Browse the repository at this point in the history
…8817)

This reverts commit dffded1, reversing
changes made to 4fad912.
  • Loading branch information
mcayuelas-ledger authored Jan 6, 2025
1 parent cfce7d9 commit 2ea3206
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
5 changes: 0 additions & 5 deletions .changeset/curly-olives-smoke.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { WalletSyncSettingsNavigator } from "./shared";
import { State } from "~/reducers/types";
import { http, HttpResponse } from "msw";
import { server } from "@tests/server";
import { crypto } from "@ledgerhq/hw-ledger-key-ring-protocol";

jest.mock("../hooks/useLedgerSyncStatus", () => ({
useLedgerSyncStatus: () => ({
Expand All @@ -16,8 +15,6 @@ jest.mock("../hooks/useLedgerSyncStatus", () => ({

describe("WalletSyncStatus", () => {
it("Should display warning banner when LedgerSync is down", async () => {
const keypair = await crypto.randomKeypair();

const { user } = render(<WalletSyncSettingsNavigator />, {
overrideInitialState: (state: State) => ({
...state,
Expand All @@ -41,13 +38,9 @@ describe("WalletSyncStatus", () => {
trustchain: {
...state.trustchain,
trustchain: {
rootId: "000c9ec1a1ab774f7eaeff2b0d4ad695f1fa07ea28d33f5d34126cb1152d6d83f6",
applicationPath: "m/0'/16'/0'",
walletSyncEncryptionKey: crypto.to_hex(keypair.privateKey),
},
memberCredentials: {
privatekey: crypto.to_hex(keypair.privateKey),
pubkey: "03d682b0be923a68e2aa077c3b49c79be57d447d8dca615628f5adceb2ccd175be",
rootId: "rootId",
applicationPath: "applicationPath",
walletSyncEncryptionKey: "walletSyncEncryptionKey",
},
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useQuery } from "@tanstack/react-query";
import { QueryKey } from "./type.hooks";
import { useLifeCycle } from "./walletSync.hooks";
import { useEffect } from "react";
import { TrustchainEjected, TrustchainNotFound } from "@ledgerhq/ledger-key-ring-protocol/errors";
import { TrustchainNotFound } from "@ledgerhq/ledger-key-ring-protocol/errors";

export function useGetMembers() {
const sdk = useTrustchainSdk();
Expand Down Expand Up @@ -43,17 +43,11 @@ export function useGetMembers() {
enabled: !!trustchain && !!memberCredentials,
});

const { isError, error, isPending, isLoading } = memberHook;

useEffect(() => {
if (isError) {
handleError(error);
}
if (isPending && !isError && !isLoading) {
// assuming that if getMembers returns undefined, it means the trustchain is ejected
handleError(new TrustchainEjected());
if (memberHook.isError) {
handleError(memberHook.error);
}
}, [handleError, error, isError, isLoading, isPending]);
}, [handleError, memberHook.error, memberHook.isError]);

return memberHook;
}

0 comments on commit 2ea3206

Please sign in to comment.