From 0820925dc59b24053b7ac237ec16557761b2ca8b Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 4 Sep 2023 13:31:51 +0200 Subject: [PATCH] frontend-app-api: validate route ref IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Camila Belo Co-authored-by: Philipp Hugenroth Signed-off-by: Patrik Oldsberg --- packages/frontend-app-api/src/createApp.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend-app-api/src/createApp.tsx b/packages/frontend-app-api/src/createApp.tsx index 996abf99ad..200e007758 100644 --- a/packages/frontend-app-api/src/createApp.tsx +++ b/packages/frontend-app-api/src/createApp.tsx @@ -146,6 +146,12 @@ export function extractRouteInfoFromInstanceTree( // TODO: join paths in a more robust way const fullPath = basePath + routePath; if (routeRef) { + const routeRefId = (routeRef as any).id; // TODO: properly + if (routeRefId !== current.id) { + throw new Error( + `Route ref '${routeRefId}' must have the same ID as extension '${current.id}'`, + ); + } results.set(routeRef, fullPath); }