Apply suggestions from code review

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2024-01-22 08:01:04 +01:00
committed by GitHub
parent 1184990aad
commit 4212a53acd
2 changed files with 3 additions and 4 deletions
@@ -289,8 +289,7 @@ describe('collectLegacyRoutes', () => {
createRoutableExtension({
name: 'Test',
mountPoint: routeRef,
component: () =>
Promise.resolve(() => {
component: async () => () => {
const app = useApp();
return <div>plugins: {app.getPlugins().map(p => p.getId())}</div>;
}),
@@ -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 <Route /> 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(
`<Route /> 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) {