From 4212a53acd84b637ccb8e08cabf540cdac6a3f0b Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Mon, 22 Jan 2024 08:01:04 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Signed-off-by: Vincenzo Scamporlino --- packages/core-compat-api/src/collectLegacyRoutes.test.tsx | 3 +-- packages/core-compat-api/src/collectLegacyRoutes.tsx | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx index b99d581983..c8d3822ae7 100644 --- a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx +++ b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx @@ -289,8 +289,7 @@ describe('collectLegacyRoutes', () => { createRoutableExtension({ name: 'Test', mountPoint: routeRef, - component: () => - Promise.resolve(() => { + component: async () => () => { const app = useApp(); return
plugins: {app.getPlugins().map(p => p.getId())}
; }), diff --git a/packages/core-compat-api/src/collectLegacyRoutes.tsx b/packages/core-compat-api/src/collectLegacyRoutes.tsx index 847c0805cb..1217f9531d 100644 --- a/packages/core-compat-api/src/collectLegacyRoutes.tsx +++ b/packages/core-compat-api/src/collectLegacyRoutes.tsx @@ -173,7 +173,7 @@ export function collectLegacyRoutes( (route: ReactNode) => { // TODO(freben): Handle feature flag and permissions framework wrapper elements if (!React.isValidElement(route) || route.type !== Route) { - throw new Error('Invalid element has been detected.'); + throw new Error(`Invalid element inside FlatRoutes, expected Route but found ${route.type}.`); } const routeElement = route.props.element; const path: string | undefined = route.props.path; @@ -187,7 +187,7 @@ export function collectLegacyRoutes( ); if (path === undefined) { throw new Error( - ` element with invalid path has been detected. Please make sure to pass the path's props`, + `Route element inside FlatRoutes had no path prop value given`, ); } if (!plugin) {