Skip to content

Commit

Permalink
Patch: search param update in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Oct 15, 2023
1 parent 1423d9e commit fefce29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hooks/ghost-legion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useGhostLegion = () => {
const [ghostLegion, setGhostLegion] = useState(Boolean(searchParams.get("ghost_legion")));
const toggleGhostLegion = () => {
setGhostLegion(!ghostLegion);
setSearchParams({ ghost_legion: !ghostLegion });
setSearchParams({ ...searchParams, ghost_legion: !ghostLegion });
};
return { ghostLegion, toggleGhostLegion };
};
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/round.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useRound = () => {
const [round, setRound] = useState(searchParams.get("round") || 1);
const onRoundChange = (value) => {
setRound(rounds[value]);
setSearchParams({ round: rounds[value] });
setSearchParams({ ...searchParams, round: rounds[value] });
};
return { rounds: roundKeys, round, roundKey: roundKeys[round - 1], onRoundChange };
};
Expand Down

0 comments on commit fefce29

Please sign in to comment.