You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Infer page navigation query types from the loader’s query schema #883
With typed routes enabled, a page loader can validate its query using defineHandler.withValidator({ query: schema }). That gives the loader typed values, but a caller building a link to the same page can still misspell a key or provide a value outside the schema.
What I checked
I ran TypeScript 7.0.2 in strict mode against generated routes in a React Pages app using void@1.11.0 and @void/react@1.11.0. The payments loader validates status against a finite set. Both calls passed:
A nonexistent route path produced the expected type error in the same check. The generated RouteOptions<P> uses one string-keyed RouteQuery for every path, while useRouter().query exposes URLSearchParams.
Request
Use the destination loader’s query schema to check structured query keys and values in routeUrl() and router.visit(). Links built with routeUrl() would pick up the same checks.
Expose the current page’s validated query values through a typed API. For schemas with defaults or coercions, navigation inputs can differ from the parsed values read by the page.
Support a functional update against the previous query so changing a filter can preserve the other filters and reset pagination.
Today each table loader sends its parsed query back as a page prop. The client keeps its own pending query, merges edits and serializes non-default values. A shared schema for reading and navigating would also catch typos in links from other pages.
Activity