Skip to content

Commit

Permalink
Fix regression in makeQueryHandler from fbf94ad
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF committed Nov 1, 2023
1 parent a6962ca commit 0ac0a33
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/hooks/useQueryParams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { isNotFalsy, mapKeys, mapValues } from '@seedcompany/common';
import {
isNotFalsy,
mapEntries,
mapKeys,
mapValues,
} from '@seedcompany/common';
import { invert, omit, pick, pickBy } from 'lodash';
import { useCallback, useMemo } from 'react';
import { useSearchParams } from 'react-router-dom';
Expand Down Expand Up @@ -178,10 +183,10 @@ type QueryParamConfigMapShape = Record<string, QueryParamConfig<any>>;
export const makeQueryHandler = <QPCMap extends QueryParamConfigMapShape>(
paramConfigMap: QPCMap
) => {
const rawKeysToOurs = mapKeys(
paramConfigMap,
(key, value) => value.key ?? key
).asRecord;
const rawKeysToOurs = mapEntries(paramConfigMap, ([key, value]) => [
value.key ?? key,
key,
]).asRecord;
const rawKeys = Object.keys(rawKeysToOurs);
const defaultValues = mapValues(
paramConfigMap,
Expand Down

0 comments on commit 0ac0a33

Please sign in to comment.