From 64c65ea918594e84cc70fbf8d9dd4a969e1a538e Mon Sep 17 00:00:00 2001 From: Hurairah Mateen Date: Tue, 11 Jun 2024 16:51:49 +0500 Subject: [PATCH] Refactor customRoutes.tsx and ProjectConfigInterface.ts to include component props (#10359) Co-authored-by: Hanzla Mateen --- packages/client/src/route/customRoutes.tsx | 4 ++-- packages/projects/ProjectConfigInterface.ts | 3 +++ packages/projects/loadRoute.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/client/src/route/customRoutes.tsx b/packages/client/src/route/customRoutes.tsx index 1c2a32e871..25ba6e4319 100644 --- a/packages/client/src/route/customRoutes.tsx +++ b/packages/client/src/route/customRoutes.tsx @@ -44,13 +44,13 @@ const CustomRoutes = ({ customRoutes }) => { }> {matchedRoutes.map((route, i) => { - const { route: r, component, props: p } = route + const { route: r, component, props: p, componentProps } = route const Element = component as any return ( } + element={} {...p} /> ) diff --git a/packages/projects/ProjectConfigInterface.ts b/packages/projects/ProjectConfigInterface.ts index 536413cf6e..e8dc50a88b 100644 --- a/packages/projects/ProjectConfigInterface.ts +++ b/packages/projects/ProjectConfigInterface.ts @@ -51,6 +51,9 @@ export interface ProjectConfigInterface { [x: string]: any exact?: boolean } + componentProps?: { + [x: string]: any + } } } diff --git a/packages/projects/loadRoute.ts b/packages/projects/loadRoute.ts index 42040b62ed..d4d73125cf 100644 --- a/packages/projects/loadRoute.ts +++ b/packages/projects/loadRoute.ts @@ -30,6 +30,7 @@ import { loadConfigForProject } from './loadConfigForProject' interface RouteData { component: ReturnType props: any + componentProps: any } export const loadRoute = async (project: string, route: string): Promise => { @@ -38,7 +39,8 @@ export const loadRoute = async (project: string, route: string): Promise