Skip to content

Commit 4c8e5b3

Browse files
committed
fix: in react ui, closing drawer also closes sidebar
Signed-off-by: Nick Mitchell <[email protected]>
1 parent c7374a3 commit 4c8e5b3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pdl-live-react/src/view/detail/DrawerContent.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,18 @@ export default function DrawerContent({ value }: Props) {
5454
const def = searchParams.get("def")
5555
const objectType = searchParams.get("type")
5656

57+
// Remove the search params that lead us here, for onCloseDrawer()
58+
searchParams.delete("id")
59+
searchParams.delete("def")
60+
searchParams.delete("get")
61+
searchParams.delete("detail")
62+
const s = searchParams.toString()
63+
5764
const navigate = useNavigate()
5865
const { pathname, hash } = useLocation()
5966
const onCloseDrawer = useCallback(
60-
() => navigate(pathname + hash), // remove query
61-
[hash, pathname, navigate],
67+
() => navigate(pathname + (s ? "?" + s : "") + hash),
68+
[hash, pathname, navigate, s],
6269
)
6370

6471
const data = useMemo(

0 commit comments

Comments
 (0)