Replies: 1 comment
-
While you cannot configure search parsing per route, you can use the following workaround: Convert the id to a string IF it is too high to parse. function customParseSearch(search: string) {
return defaultParseSearch(search.replace(/id=([\d]{16,})/g, `id="$1"`));
}
const router = new Router({
routeTree,
parseSearch: customParseSearch,
}) Example: https://codesandbox.io/p/devbox/charming-frog-vgmcwm?file=%2Fsrc%2Fmain.tsx%3A201%2C1-212%2C3 Go to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm trying to gradually add Tanstack router to my project that is already using native
URLSearchParams
from before.However, some old routes are using large numbers as a search param, which are modified when the router attempts to parse them as numbers. Ideally, they should be treated as strings unless I'm opting into using the router's search param implementation.
Expected:
Result:
Using the proper search param implementation and adding quotes around the numbers would unfortunately break old links.
Beta Was this translation helpful? Give feedback.
All reactions