feat: provide location in onEnter/onStay/onLeave hooks#3622
Conversation
|
View your CI Pipeline Execution ↗ for commit 406cec6.
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/create-router
@tanstack/create-start
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-with-query
@tanstack/react-start
@tanstack/react-start-api-routes
@tanstack/react-start-client
@tanstack/react-start-config
@tanstack/react-start-plugin
@tanstack/react-start-router-manifest
@tanstack/react-start-server
@tanstack/react-start-server-functions-client
@tanstack/react-start-server-functions-fetcher
@tanstack/react-start-server-functions-handler
@tanstack/react-start-server-functions-ssr
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-start
@tanstack/solid-start-api-routes
@tanstack/solid-start-client
@tanstack/solid-start-config
@tanstack/solid-start-plugin
@tanstack/solid-start-router-manifest
@tanstack/solid-start-server
@tanstack/solid-start-server-functions-client
@tanstack/solid-start-server-functions-fetcher
@tanstack/solid-start-server-functions-handler
@tanstack/solid-start-server-functions-ssr
@tanstack/start
@tanstack/start-config
@tanstack/start-server-functions-server
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
a0d83cb to
e6aef99
Compare
017c52c to
e0dae9b
Compare
There was a problem hiding this comment.
rather should have location defined in onEnter?
please also add a test for onStay and onLeave
There was a problem hiding this comment.
also applies to react-router of course
There was a problem hiding this comment.
Was just copying the style from above
There was a problem hiding this comment.
its in an onEnter describe block
There was a problem hiding this comment.
we should be able to supply the search type here (same for the others as well)
probably makes sense to create a type OnMatchOptions<TSearch> = {location:ParsedLocation<TSearch>
and use this for all 3 methods?
There was a problem hiding this comment.
i think this additional typing is a little out of my immediate grasp - can you give some more guidance
There was a problem hiding this comment.
before we do that, what is the semantic of location in each of these hooks?
I think in case of onLeave location is anything BUT the match, so we cannot statically type the search here.
whereas for the other hooks, the route's search is present in location
There was a problem hiding this comment.
Its the location that will resolve (assuming nothing thrown) - played with current / next like the useBlocker stuff but decided on this approach.
9d71302 to
e285bbe
Compare
wrong but as a starting point
768968a to
879b53b
Compare
|
@schiller-manuel how do you want to reconcile this? |
|
Thanks for the PR. I'm closing it because it has fallen behind main (sorry it got lost in the shuffle), and the lifecycle implementation has since moved into router-core. The feature is still useful, so we’ve opened #7778 to track a fresh implementation. A new PR based on that issue would be welcome if you are still interested! |
https://discord.com/channels/719702312431386674/1345441363831033960