From c615b4354aa8f5a19c9010be1642391a14270d2a Mon Sep 17 00:00:00 2001 From: Tarik Gul <47201679+TarikGul@users.noreply.github.com> Date: Mon, 13 May 2024 10:17:51 -0700 Subject: [PATCH] Backwards compatibility for identityOf (#10570) * Backwards compatibility for identityOf * Fix null check * nit --- .../src/AccountSidebar/RegistrarJudgement.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/react-components/src/AccountSidebar/RegistrarJudgement.tsx b/packages/react-components/src/AccountSidebar/RegistrarJudgement.tsx index 523b3202f4..3c77574d47 100644 --- a/packages/react-components/src/AccountSidebar/RegistrarJudgement.tsx +++ b/packages/react-components/src/AccountSidebar/RegistrarJudgement.tsx @@ -35,10 +35,18 @@ const JUDGEMENT_ENUM = [ ]; const OPT_ID = { - transform: (optId: Option]>>): HexString | null => - optId.isSome - ? optId.unwrap()[0].info.hash.toHex() - : null + transform: (optId: Option]>>): HexString | null => { + const id = optId.isSome + ? optId.unwrap() + : null; + + // Backwards compatibility - https://github.com/polkadot-js/apps/issues/10493 + return !id + ? null + : Array.isArray(id) + ? id[0].info.hash.toHex() + : (id as unknown as PalletIdentityRegistration).info.hash.toHex(); + } }; function RegistrarJudgement ({ address, registrars, toggleJudgement }: Props): React.ReactElement {