From 13ab5af50809fc08e63654fcf20a870e4176a725 Mon Sep 17 00:00:00 2001 From: Aniket Katkar Date: Fri, 10 Oct 2025 18:14:00 +0530 Subject: [PATCH] Safeguard the plugins use to avoid the flatMap error occurred during hot reloading (#23831) --- .../main/resources/ui/src/components/AppRouter/AppRouter.tsx | 2 +- .../ui/src/components/AppRouter/AuthenticatedAppRouter.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AppRouter.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AppRouter.tsx index d7f2f884e45..4c5a90c50b5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AppRouter.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AppRouter.tsx @@ -116,7 +116,7 @@ const AppRouter = () => { {/* Render APP position plugin routes (they handle their own layouts) */} {isAuthenticated && - plugins.flatMap((plugin) => { + plugins?.flatMap((plugin) => { const routes = plugin.getRoutes?.() || []; // Filter routes with APP position const appRoutes = routes.filter( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AuthenticatedAppRouter.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AuthenticatedAppRouter.tsx index 28daa1ebe7b..77f4621bf4b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AuthenticatedAppRouter.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AppRouter/AuthenticatedAppRouter.tsx @@ -292,7 +292,7 @@ const AuthenticatedAppRouter: FunctionComponent = () => { // Get all plugin routes that should be in AUTHENTICATED_ROUTE position const pluginRoutes = useMemo(() => { - return plugins.flatMap((plugin) => { + return plugins?.flatMap((plugin) => { const routes = plugin.getRoutes?.() || []; // Filter routes that don't have position or have AUTHENTICATED_ROUTE position