Skip to content

Commit

Permalink
improve removal of params when clicking on the logo in the navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
F-Shahali committed Jan 6, 2025
1 parent bbac4f9 commit dc370ca
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/Views/Layout/Navbar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ import { setOpenShareModal, useLocalCache } from '@src/Tools/Store/slices/LocalC
const NavBar = () => {
const { activePage } = useLocalCache();
const { dispatch } = useStore();
const setSearchParams = useSearchParams()[1];
const [searchParams, setSearchParams] = useSearchParams();

return (
<div className='navbar-layout'>
<Navbar className='navbar'>
<Navbar.Brand
className='nav-brand'
onClick={() =>
setSearchParams(params => {
params.forEach((val, key) => {
params.delete(key);
});
return params;
})
}>
onClick={() => {
const newParams = new URLSearchParams(searchParams);
searchParams.forEach((_, key) => {
newParams.delete(key);
});
setSearchParams(newParams);
}}>
<Logo className='logo-text' />
</Navbar.Brand>

Expand Down

0 comments on commit dc370ca

Please sign in to comment.