From 8569a0362b6930d289d38f91ec1ea82a899de68d Mon Sep 17 00:00:00 2001 From: James Grugett Date: Wed, 23 Mar 2022 00:34:04 -0500 Subject: [PATCH] Fix not being able to go back on markets pages / communities --- web/hooks/use-sort-and-query-params.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/hooks/use-sort-and-query-params.tsx b/web/hooks/use-sort-and-query-params.tsx index 74de7f4c..642a4e90 100644 --- a/web/hooks/use-sort-and-query-params.tsx +++ b/web/hooks/use-sort-and-query-params.tsx @@ -69,7 +69,9 @@ export function useQueryAndSortParams(options?: { if (router.isReady && !sort && shouldLoadFromStorage) { const localSort = localStorage.getItem(MARKETS_SORT) as Sort if (localSort) { - setSort(localSort) + router.query.s = localSort + // Use replace to not break navigating back. + router.replace(router, undefined, { shallow: true }) } } })