Skip to content

Commit 6a5f43f

Browse files
committed
frontend: createRouteURL: Accept paths for route names
This change adds backward compatibility for plugins calling createRouteURL with a path template instead of a registered route name. This serves as a temporary fix to avoid breaking those plugins.
1 parent 40f6255 commit 6a5f43f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

frontend/src/lib/router/createRouteURL.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ export function createRouteURL(routeName: string, params: RouteURLProps = {}) {
7676
const route = matchingStoredRouteByName || matchingStoredRouteByPath || getRoute(routeName);
7777

7878
if (!route) {
79+
// Backward compatibility: some plugins call createRouteURL with a
80+
// path template instead of a registered route name. This serves
81+
// as a temporary fix to avoid breaking those plugins.
82+
//
83+
// @todo: Merge the plugin routes into the main store.
84+
if (routeName.startsWith('/')) {
85+
return generatePath(routeName, params);
86+
}
7987
return '';
8088
}
8189

0 commit comments

Comments
 (0)