From 47a1e9bb6fb155f735a579f05ee9114ebe5069c0 Mon Sep 17 00:00:00 2001 From: Pratik Langde Date: Tue, 27 Oct 2026 11:50:50 +0530 Subject: [PATCH] OCPBUGS-82111: contain hookProvider errors so a plugin cannot white-screen Console console.flag handlers already catch throws. console.flag/hookProvider handlers are React hooks, so they cannot use try/catch. Wrap each resolver in ErrorBoundary; FeatureFlagExtensionLoader sits outside the page boundary and a throw currently unmounts the whole app. Signed-off-by: Pratik Langde --- .../flags/FeatureFlagExtensionLoader.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/packages/console-app/src/components/flags/FeatureFlagExtensionLoader.tsx b/frontend/packages/console-app/src/components/flags/FeatureFlagExtensionLoader.tsx index 312b83eac5f..4c9338096d0 100644 --- a/frontend/packages/console-app/src/components/flags/FeatureFlagExtensionLoader.tsx +++ b/frontend/packages/console-app/src/components/flags/FeatureFlagExtensionLoader.tsx @@ -16,6 +16,7 @@ import type { ResolvedExtension } from '@console/dynamic-plugin-sdk/src/types'; import { setFlag, updateModelFlags } from '@console/internal/actions/flags'; import type { OnChange } from '@console/plugin-sdk/src/utils/useCompareExtensions'; import { useCompareExtensions } from '@console/plugin-sdk/src/utils/useCompareExtensions'; +import { ErrorBoundary } from '@console/shared/src/components/error/error-boundary'; import { useConsoleDispatch } from '@console/shared/src/hooks/useConsoleDispatch'; import { useConsoleSelector } from '@console/shared/src/hooks/useConsoleSelector'; import { FeatureFlagExtensionHookResolver } from './FeatureFlagExtensionHookResolver'; @@ -136,12 +137,17 @@ export const FeatureFlagExtensionLoader: FC = () => { properties: { handler }, uid, } = nf; + // hookProvider handlers are React hooks, so they cannot be wrapped in + // try/catch (Rules of Hooks). console.flag handlers already catch + // errors; without a boundary here a throw unmounts the whole app + // (FeatureFlagExtensionLoader sits outside the page ErrorBoundary). return ( - + + + ); })}