From 63c1fa32b5edebf7795f636a7e1cfe8c665384e9 Mon Sep 17 00:00:00 2001 From: acouch Date: Tue, 23 Jul 2024 14:15:53 -0400 Subject: [PATCH] Update useSearchParamUpdater.ts to include comments --- frontend/src/hooks/useSearchParamUpdater.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/hooks/useSearchParamUpdater.ts b/frontend/src/hooks/useSearchParamUpdater.ts index e7ccc5038e..d67367882f 100644 --- a/frontend/src/hooks/useSearchParamUpdater.ts +++ b/frontend/src/hooks/useSearchParamUpdater.ts @@ -10,9 +10,15 @@ export function useSearchParamUpdater() { const params = new URLSearchParams(searchParams); const updateQueryParams = ( + // The parameter value that is not the query term. Query term is treated + // separately because updates to it are captured, ie if a user updates the + // search term and then clicks a facet, the updated term is used. queryParamValue: string | Set, + // Key of the parameter. key: string, queryTerm: string | null | undefined, + // Determines whether the state update scrolls the user to the top. This + // is useful for components that are expected to be "under the fold." scroll = false, ) => { const finalQueryParamValue =