From 9d7bec3238e570a40e837a8db0e1a4f30808e4a3 Mon Sep 17 00:00:00 2001 From: Karel Hala Date: Mon, 11 Nov 2024 16:55:37 +0100 Subject: [PATCH] fix(basename): basename for workspaces is calculated incorrectly --- src/Routing.tsx | 5 ++++- src/presentational-components/shared/AppLink.tsx | 15 ++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Routing.tsx b/src/Routing.tsx index 9ceadb129..7fa536c84 100644 --- a/src/Routing.tsx +++ b/src/Routing.tsx @@ -284,13 +284,16 @@ const Routing = () => { const routes = getRoutes({ enableServiceAccounts, isITLess, isWorkspacesFlag }); const renderedRoutes = useMemo(() => renderRoutes(routes as never), [routes]); + + const { getBundle, getApp } = useChrome(); + const defaultBasename = `/${getBundle()}/${getApp()}`; return ( }> {renderedRoutes} {/* Catch all unmatched routes */} - } /> + } /> ); diff --git a/src/presentational-components/shared/AppLink.tsx b/src/presentational-components/shared/AppLink.tsx index 2f54cec78..f335667da 100644 --- a/src/presentational-components/shared/AppLink.tsx +++ b/src/presentational-components/shared/AppLink.tsx @@ -1,3 +1,4 @@ +import useChrome from '@redhat-cloud-services/frontend-components/useChrome'; import React, { LegacyRef } from 'react'; import { Link, LinkProps, To } from 'react-router-dom'; @@ -17,11 +18,15 @@ export const mergeToBasename = (to: To, basename = '/iam/user-access') => { }; }; -const AppLink: React.FC = React.forwardRef((props: AppLinkProps, ref: LegacyRef) => ( - - - -)); +const AppLink: React.FC = React.forwardRef((props: AppLinkProps, ref: LegacyRef) => { + const { getBundle, getApp } = useChrome(); + const defaultBasename = `/${getBundle()}/${getApp()}`; + return ( + + + + ); +}); AppLink.displayName = 'AppLink';