Fleet UI: Clicking on active nav resets all filters except team ID (#16198)
This commit is contained in:
@@ -149,12 +149,20 @@ const SiteTopNav = ({
|
||||
? navItem.location.pathname
|
||||
: currentPath;
|
||||
|
||||
const includeTeamId = (activePath: string) => {
|
||||
if (currentQueryParams.team_id) {
|
||||
return `${path}?team_id=${currentQueryParams.team_id}`;
|
||||
}
|
||||
return activePath;
|
||||
};
|
||||
|
||||
// Clicking an active link returns user to default page
|
||||
// Resetting all filters except team ID
|
||||
// TODO: Find best pattern(one that doesn't dispatch a
|
||||
// replace to the same url, which triggers a re-render)
|
||||
return (
|
||||
<li className={navItemClasses} key={`nav-item-${name}`}>
|
||||
<a className={`${navItemBaseClass}__link`} href={path}>
|
||||
<a className={`${navItemBaseClass}__link`} href={includeTeamId(path)}>
|
||||
<span
|
||||
className={`${navItemBaseClass}__name`}
|
||||
data-text={navItem.name}
|
||||
|
||||
Reference in New Issue
Block a user