Skip to content

Commit b0729b6

Browse files
fix(react): Match routes with parseSearch option in TanStack Router instrumentation (#14328)
1 parent 9581a2e commit b0729b6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/react/src/tanstackrouter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function tanstackRouterBrowserTracingIntegration(
4444
if (instrumentPageLoad && initialWindowLocation) {
4545
const matchedRoutes = castRouterInstance.matchRoutes(
4646
initialWindowLocation.pathname,
47-
initialWindowLocation.search,
47+
castRouterInstance.options.parseSearch(initialWindowLocation.search),
4848
{ preload: false, throwOnError: false },
4949
);
5050

packages/react/src/vendor/tanstackrouter-types.ts

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ SOFTWARE.
2929
export interface VendoredTanstackRouter {
3030
history: VendoredTanstackRouterHistory;
3131
state: VendoredTanstackRouterState;
32+
options: {
33+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
34+
parseSearch: (search: string) => Record<string, any>;
35+
};
3236
matchRoutes: (
3337
pathname: string,
3438
// eslint-disable-next-line @typescript-eslint/ban-types

0 commit comments

Comments
 (0)