Skip to content

Commit

Permalink
fix warning 'Passing through parameter * during decoding since it was…
Browse files Browse the repository at this point in the history
… not configured.'
  • Loading branch information
Shaddix committed Jun 16, 2023
1 parent 3d75833 commit a512d6a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/create-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
useMatch,
useParams,
} from 'react-router-dom';
import { decodeQueryParams, encodeQueryParams } from 'serialize-query-params';
import {
StringParam,
decodeQueryParams,
encodeQueryParams,
} from 'serialize-query-params';
import {
CreateRouteResult,
ParamParseKeyOptional,
Expand Down Expand Up @@ -76,6 +80,11 @@ export function createRoute<
let params = useParams() as any;
const [queryParams, setQueryParams] = useQueryParams(searchParamsConfig!);
if (urlParamsConfig) {
// fix warning 'Passing through parameter * during decoding since it was not configured.'
// even if you don't have '*' in your pattern it gets added to params
if (params['*'] && !urlParamsConfig['*']) {
(urlParamsConfig as any)['*'] = StringParam;
}
params = decodeQueryParams(
urlParamsConfig as any,
params as any,
Expand Down

0 comments on commit a512d6a

Please sign in to comment.