Skip to content

Commit

Permalink
fix ReactRouter useMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Delusoire committed Aug 8, 2024
1 parent 8cb076b commit 66fa7e3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions modules/stdlib/src/webpack/ReactRouter.xpui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const [ReactRouterModuleID] = chunks.find(([_, v]) => v.toString().includes("Rea
const ReactRouterModule = Object.values(require(ReactRouterModuleID));

// https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L131
export const useMatch: Function = findBy(
"let{pathname:",
/\(([a-zA-Z_\$][\w\$]*),([a-zA-Z_\$][\w\$]*)\)\),\[\2,\1\]/,
)(ReactRouterModule);
export const useMatch: Function = ReactRouterModule.find((f) =>
f.toString().includes("let{pathname:") && !f.toString().includes(".createElement(")
);

0 comments on commit 66fa7e3

Please sign in to comment.