Replace instead of push when modifying search query params

This commit is contained in:
Marshall Polaris 2022-07-19 00:30:43 -07:00
parent f841c9acd2
commit 2bd1099c38

View File

@ -82,7 +82,7 @@ export function useUpdateQueryAndSort(props: {
const setSort = (sort: Sort | undefined) => {
if (sort !== router.query.s) {
router.query.s = sort
router.push({ query: { ...router.query, s: sort } }, undefined, {
router.replace({ query: { ...router.query, s: sort } }, undefined, {
shallow: true,
})
if (shouldLoadFromStorage) {
@ -102,7 +102,7 @@ export function useUpdateQueryAndSort(props: {
} else {
delete router.query.q
}
router.push({ query: router.query }, undefined, {
router.replace({ query: router.query }, undefined, {
shallow: true,
})
track('search', { query })