Skip to content

Commit

Permalink
feat: preserve pathname on route change
Browse files Browse the repository at this point in the history
  • Loading branch information
zovomat committed May 9, 2022
1 parent bc77bc9 commit a2c3252
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/shell/shell-primary-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ const ShellPrimaryBar: FC<{ activeRoute: AppRoute }> = ({ activeRoute }) => {
}, [primaryBarViews]);
useEffect(() => {
if (activeRoute) {
setRoutes((r) => ({ ...r, [activeRoute.id]: trim(history.location.pathname, '/') }));
setRoutes((r) => ({
...r,
[activeRoute.id]: `${trim(history.location.pathname, '/')}${history.location.search}`
}));
}
}, [activeRoute, history.location.pathname, primaryBarViews]);
}, [activeRoute, history.location, primaryBarViews]);
const primaryBarAccessoryViews = useAppStore((s) => s.views.primaryBarAccessories);
const accessories = useMemo(
() =>
Expand Down

0 comments on commit a2c3252

Please sign in to comment.