Skip to content

Commit

Permalink
Fix query params - remove on close (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrlarano authored Mar 20, 2024
1 parent a828586 commit 3e13b01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/kits/core-ui/components/helpers/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ export const pushQueryParam = (queryParams = {}) => {
const newUrl = new URL(window.location.href);

Object.entries(queryParams).forEach(([key, val]) => {
newUrl.searchParams[val ? 'set' : 'delete'](key, String(val));
if (val) {
newUrl.searchParams.set(key, String(val));
} else {
newUrl.searchParams.delete(key);
}
});

window.history.pushState({path: String(newUrl)}, '', newUrl);
Expand Down

0 comments on commit 3e13b01

Please sign in to comment.