Tanstack router?
Has anyone managed to use tanstack router with refine?
10 Replies
Hi @.d10. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not mention the use of tanstack router with refine. However, refine does provide flexibility in terms of routing and allows you to use any router library that you want. It has built-in router packages for Next.js, Remix, and React Router v6.
For more information, you can refer to the routerProvider documentation (https://refine.dev/docs/core/providers/router-provider) and the router packages documentation (https://refine.dev/docs/packages/documentation/routers/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@133351012252647425> kapa.ai is still learning and improving, please let us know how it did by reacting below
fascinating-indigo•12mo ago
Hello @.d10, we aren't aware of anyone doing this, yet. Maybe we can discuss with @core team. You can also start a discussion on this topic!
Hello @.d10 we suggest you to use react-router, which is stable and reliable. Tanstack router package was discontinued, renamed in the past and we can't rely on that for now.
metropolitan-bronze•12mo ago
Hi thanks for the reply. Tanstack router isn't discontinued. It's been in beta for a while and due to be released soon I think. https://tanstack.com/router/v1
Not sure how hard it will be to make a router provider for it since it's really strict with types and routes defined but I'm going to take a look
TanStack Router | React Router, Solid Router, Svelte Router, Vue Ro...
Powerful routing and first-class search-param APIs for JS/TS, React, Solid, Vue and Svelte
metropolitan-bronze•11mo ago
Hey @.d10, refine had the tanstack router (it was known as react-location back then) integration in v3 but we couldn't spare time to have it maintained because of the constant changes in its API. Now if it's stable we can discuss our opportunities to re-implement the integration with the latest version.
For the short term, I don't think we can focus on this implementation with our team but would love to support the community if there's anyone trying to implement it. 🚀 Now we'll wait to see if there are enough users wanting this integration 😅
other-emerald•11mo ago
Would love to see Tanstack Router implemented, the DX is killer and would pair up perfectly with Refine's DX since it plays so well with React Query 🙌.
Honestly, it's the best routing system out there!
I really like the whole relative path thing and the ability to set origin and destination on the fly, it sorts out so many routing headaches. This makes dealing with tricky routes like dynamic, authenticated, i18n, and contextualized routes a breeze, especially when you don't know the full path upfront, cutting down on the need to pass around a bunch of contexts and params to figure out the right route.
Also, I think it's the only one giving full type-safety for path/search params, which is a big deal when you're building a dashboard juggling multiple search parameters for table filters and actions.
And lastly, its per-route caching system is a lifesaver, significantly reducing the instances of requests that should ideally remain fresh.
fascinating-indigo•8mo ago
Hey all ( @d10, @aliemir, @Batu ) FWIW Tanstack had pushed their router package out of beta a little while ago. I took a stab at implementing the provider. I haven't really tested any of it yet but if anyone is interested in a WIP provider example, I'd be happy to share. I'm a little sketchy on all of the proper router API's but every piece seems to be there. Cheers!
metropolitan-bronze•8mo ago
Hey @hazah, if you've end up releasing your implementation as a package, we'd be happy to list it in our documentation and mention it 🚀 🚀
other-emerald•8mo ago
Would love to see a first working implementation!
fascinating-indigo•8mo ago
Will keep you guys posted.
Had been MIA as I was under the weather, but while I don't have a package to show off yet, I'd like to report I'm having success and gaining some momentum. I have one concern WRT some of the mysterious inner workings of Refine's
RouterBindings
interface. Specifically the signature of the GoFunction
that expects string | void
as the return type... Tanstack's Router's final result from its imperative navigate
function is string | Promise<void>
instead. Preliminary tests (and thoughts) suggest that this can still work, as Refine's assumption is void
which means the return value is not necessary, following that it would seem like there's no harm in allowing the promise to resolve async... but I have no insight into this. Thank you for taking your time to read this. Hope you have a great weekend.