From b0998703702dd924d1a785972b759fe9db1e3c9a Mon Sep 17 00:00:00 2001 From: estifanos Date: Wed, 26 Aug 2026 09:52:31 +0000 Subject: [PATCH] fix: prevent out-of-bounds wizard steps and remove duplicate FieldCondition property definition --- .../features/licensing/pages/LicenseApplicationPage.tsx | 8 ++++++++ libs/api/src/lib/features/licensing/licensing.types.ts | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx b/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx index 73728c62e..a7b4f92ac 100644 --- a/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx +++ b/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx @@ -356,6 +356,14 @@ export function LicenseApplicationPage() { [steps], ); + // A section-level showWhen can remove a step while the wizard is open + // (ENDORSEMENT_SEAFARER's certificate sections follow the chosen scope). + // Clamp so `steps[active]` can never go out of bounds if a seed ever lets + // a later answer hide an earlier step. + useEffect(() => { + if (active > steps.length - 1) setActive(Math.max(0, steps.length - 1)); + }, [active, steps.length]); + if (loadingConfig || !config || !appId || !application) { return ; } diff --git a/libs/api/src/lib/features/licensing/licensing.types.ts b/libs/api/src/lib/features/licensing/licensing.types.ts index a89fc0e06..0be26f0ab 100644 --- a/libs/api/src/lib/features/licensing/licensing.types.ts +++ b/libs/api/src/lib/features/licensing/licensing.types.ts @@ -67,8 +67,6 @@ export type FormFieldType = | "TIN"; export interface FieldCondition { - /** Omitted when `anyOf` is used instead — see below. */ - field?: string; /** Omitted when `anyOf` is used instead — see below. */ field?: string; equals?: string | number | boolean;