mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
fixed tripping inside single sidebar
This commit is contained in:
parent
bb2e814cf2
commit
32aaa1e8db
2 changed files with 15 additions and 7 deletions
|
@ -35,7 +35,7 @@ const ProfileSidebar: VFC<ProfileSidebarProps> = ({
|
|||
page: !isNil(val) ? tabs[val] : undefined,
|
||||
});
|
||||
},
|
||||
[open],
|
||||
[open, onRequestClose],
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
@ -43,6 +43,16 @@ export const SidebarProvider = <T extends SidebarComponent>({
|
|||
.join("&");
|
||||
const url = path + "?sidebar=" + name + (query && `&${query}`);
|
||||
|
||||
// don't store history inside the same sidebar
|
||||
if (router.query?.sidebar === name) {
|
||||
void router.replace(url, url, {
|
||||
shallow: true,
|
||||
scroll: false,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void router.push(url, url, {
|
||||
shallow: true,
|
||||
scroll: false,
|
||||
|
@ -54,12 +64,10 @@ export const SidebarProvider = <T extends SidebarComponent>({
|
|||
const close = useCallback(() => {
|
||||
const [path] = router.asPath.split("?");
|
||||
|
||||
// void router.replace(path, path, {
|
||||
// shallow: true,
|
||||
// scroll: false,
|
||||
// });
|
||||
|
||||
router.back();
|
||||
void router.replace(path, path, {
|
||||
shallow: true,
|
||||
scroll: false,
|
||||
});
|
||||
}, [router]);
|
||||
|
||||
const value = useMemo<ContextValue>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue