Im creating a search page so I am using the URL params to handle the filters, such as product category and price.
This is my current method that handles adding and removing the URL params:
function handleCheck(checked: Boolean, id: string, option) {
if (checked) {
if (router.query[id]) {
router.query[id] += `,${option.value}`;
} else {
router.query[id] = `${option.value}`;
}
}
if (!checked) {
if (router.query[id]) {
let param = router.query[id].toString();
let array = param.split(",");
array = array.filter((param) => param !== option.value);
router.query[id] = array;
}
}
router.push(router);
}
I get these warnings everytime the URL changes: