toticozeni
toticozeni
WWasp
Created by Sven on 3/29/2025 in #🙋questions
Change tab title to what page user is on
This would probably be the most scalable solution longterm.
16 replies
WWasp
Created by Sven on 3/29/2025 in #🙋questions
Change tab title to what page user is on
Both work.
16 replies
WWasp
Created by Sven on 3/29/2025 in #🙋questions
Change tab title to what page user is on
Do it for every page in Root or do it manually on each page.
16 replies
WWasp
Created by Sven on 3/29/2025 in #🙋questions
Change tab title to what page user is on
Oh, it looks like we are missing title property for page. We should definitely open an issue for that. The suggested Root solution works, but I would do something like this, it should be easier to maintain:
const = pathnameToTitle = {
routes.DashboardPage.to: 'SaaS - Dashboard',
// ...
};

export default function Root({ children }) {
const location = useLocation();

useEffect(() => {
const title = pathnameToTitle[location.pathname];
if (title) document.title = title;
}, [location]);

return <>{children}</>;
}
const = pathnameToTitle = {
routes.DashboardPage.to: 'SaaS - Dashboard',
// ...
};

export default function Root({ children }) {
const location = useLocation();

useEffect(() => {
const title = pathnameToTitle[location.pathname];
if (title) document.title = title;
}, [location]);

return <>{children}</>;
}
The problem with Root approach is that we need to manually update the object each time we add another page. But it's less work than doing useEffect on each Page. EDIT: added Vinny's suggestion
16 replies
WWasp
Created by pipas on 3/4/2025 in #🙋questions
Is the security vulnerability fixed?
Yeah, as long as the latest version is used, all should be alright.
8 replies
WWasp
Created by pipas on 3/4/2025 in #🙋questions
Is the security vulnerability fixed?
The vulnerability is fixed. 😁
8 replies