Skip to content

Commit

Permalink
setQueryParams function is not stable #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddix committed Aug 17, 2022
1 parent 6df9301 commit 559b8e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/useQueryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const useQueryParams = <QPCMap extends QueryParamConfigMap>(
typeof changes === 'function'
? changes(resultRef.current as any)
: changes;
const encoded = encodeQueryParams(paramConfigMap, values);
const encoded = encodeQueryParams(paramConfigMapRef.current, values);
Object.keys(values).forEach((key) => {
const keyValue = (encoded as any)[key];
if (Array.isArray(keyValue)) {
Expand All @@ -85,7 +85,7 @@ export const useQueryParams = <QPCMap extends QueryParamConfigMap>(

setSearchParams(searchParamsRef.current, navigateOptions);
},
[paramConfigMap, setSearchParams],
[setSearchParams],
);

return useMemo(
Expand Down

0 comments on commit 559b8e0

Please sign in to comment.