Skip to content

Commit d8f5065

Browse files
ui: Fix selected tab hightlights
1 parent 7ec770f commit d8f5065

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

shell-ui/src/navbar/NavBar.tsx

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -122,30 +122,6 @@ const Link = ({
122122
);
123123
};
124124

125-
function prefetch(url: string) {
126-
return new Promise((resolve, reject) => {
127-
const existingElement = [
128-
...(document.head?.querySelectorAll('script') || []),
129-
// @ts-expect-error - FIXME when you are working on it
130-
].find((scriptElement) => scriptElement.attributes.src?.value === url);
131-
132-
if (existingElement) {
133-
// @ts-expect-error - FIXME when you are working on it
134-
resolve();
135-
}
136-
137-
const script = document.createElement('script');
138-
script.src = url;
139-
script.async = true;
140-
script.onload = (evt) => {
141-
script.setAttribute('data-loaded', 'true');
142-
resolve(evt);
143-
};
144-
script.onerror = reject;
145-
document.head?.appendChild(script);
146-
});
147-
}
148-
149125
export const useNavbarLinksToActions = (
150126
links: TypeLink[],
151127
): {
@@ -154,8 +130,8 @@ export const useNavbarLinksToActions = (
154130
}[] => {
155131
const location = useLocation();
156132
const doesRouteMatch = useCallback(
157-
(path: RouteProps) => {
158-
return matchPath(path.path + '*', location.pathname);
133+
({ path, exact }: { path: string; exact: boolean }) => {
134+
return matchPath(path + (exact ? '' : '*'), location.pathname);
159135
},
160136
[location],
161137
);
@@ -181,6 +157,7 @@ export const useNavbarLinksToActions = (
181157
.find((link) =>
182158
link.view.isFederated
183159
? doesRouteMatch({
160+
exact: link.view.view.exact,
184161
path: link.view.view.activeIfMatches
185162
? new RegExp(
186163
link.view.app.appHistoryBasePath +

0 commit comments

Comments
 (0)