Skip to content

Commit 726e327

Browse files
fix: topbar page title (#1880)
Fixes the page title for the topbar, using only the route instead of the redirect state + route Closes #1855
1 parent 158dd79 commit 726e327

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

dashboard/src/components/TopBar/TopBar.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { FormattedMessage } from 'react-intl';
22

3-
import {
4-
useSearch,
5-
useNavigate,
6-
useRouterState,
7-
useMatches,
8-
} from '@tanstack/react-router';
3+
import { useSearch, useNavigate, useMatches } from '@tanstack/react-router';
94

105
import { useCallback, useEffect, useMemo, useState, type JSX } from 'react';
116

@@ -121,9 +116,6 @@ const TitleName = ({ basePath }: { basePath: string }): JSX.Element => {
121116
const TopBar = (): JSX.Element => {
122117
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
123118
const matches = useMatches();
124-
const redirectStateFrom = useRouterState({
125-
select: s => s.location.state.from,
126-
});
127119

128120
const routeInfo = useMemo(() => {
129121
const lastMatch = matches[matches.length - 1];
@@ -142,8 +134,6 @@ const TopBar = (): JSX.Element => {
142134
};
143135
}, [matches]);
144136

145-
const basePath = redirectStateFrom ?? routeInfo.firstUrlLocation;
146-
147137
return (
148138
<>
149139
<div className="fixed top-0 z-10 flex h-20 w-full max-w-full bg-white px-6 md:max-w-[calc(100%-14rem)] md:px-16">
@@ -159,7 +149,7 @@ const TopBar = (): JSX.Element => {
159149
<HiMenu className="size-6" />
160150
</Button>
161151
<span className="mr-2 text-2xl sm:mr-10">
162-
<TitleName basePath={basePath} />
152+
<TitleName basePath={routeInfo.firstUrlLocation} />
163153
</span>
164154
{(routeInfo.isTreeListing || routeInfo.isHardwarePage) && (
165155
<OriginSelect isHardwarePath={routeInfo.isHardwarePage} />

0 commit comments

Comments
 (0)