-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for react-router 6.4.0 #95
Comments
wip |
@voodoocreation it seems working https://codesandbox.io/s/redux-first-history-demo-rr6-forked-8ihzv6?file=/src/App.jsx Am I missing something? |
Hey @salvoravida - yeah the old API still works in Using this newer API is what enables the other new features of It's possible to just use the older API and not make use of these new features (which is what I'm currently having to do) but it would be good to provide some tooling that works with their new API as well to be feature-complete (plus I'm not sure what the future of |
You might have to look at the internals of those new methods to see how it's integrating with the history events to see what you'll need to bind to to get the Redux integration working. Fingers crossed it's still possible and isn't something they've obfuscated within those new methods 🤞 |
I am trying this now with I have tried debugging this and I cannot figure out why If anyone has any insight into what might be happening here, it would be appreciated. |
I had a config working with
|
Hi, are u able to find any solution for this thank u |
I am still unable to get this to work with the current versions of |
I'm trying to choose a router for all my projects for the next few years and I'm thinking that the lack of activity on this issue makes react-router a deal-breaker if I'm including this package in my stack and want the newer features. Does that sound right? It doesn't seem like a solution is coming after 6 months of activity. Or are you just waiting to see where the dust settles on newer versions of the router? |
Any updates on this? |
Seems like making your own version of https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/index.tsx#L229 could work, where you allow passing in history? |
I've tried creating my own create...Router from copying the code from createBrowserRouter but passing in history as a curried argument example:
The issues I'm facing are. / Argument of type 'History' is not assignable to parameter of type 'import("/workspaces/.../node_modules/.pnpm/@remix-run+router@1.9.0/node_modules/@remix-run/router/dist/history").History'. A call to history.createURL within react-router |
I've had a bit more of a go at this by adding the missing functions that the @remix-run/router library expects (dependency of react-router) to the history instance im passing into my createHistoryRouter implementation. (most functions are copied from @remix-run/router) example:
however when navigating using a Link component the callstack explodes. checking Redux devtools it looks like it's got stuck in a loop submitting @@router/LOCATION_CHANGE actions. I looked at the notes for the methods I've added from the History type. I'll post here
I also fixed this problem with some middleware for redux that watches out for this looping behaviour. I've managed to get a simple demonstration working. I also made sure to add this middleware before the router middleware. the middleware is as follows:
Although this works, it doesn't actually fix the underlying issue. |
@kale1d0code, Hope you succeed with you attempt of making React router >= 6.4 to work with redux. But, I ask this question to the entire Redux community out there, Why can't we create or fork the React router V5 and make a Router that has Redux as its integral core logic. I think that would be the permanent solution. Remix and Nextjs have their plans to support RSC and having not to expose history makes their work easier. The choice that the redux community has is to create a Router that works only through redux and on the client side. For rest of the case, just forget the router and have redux islands that work per page. |
I'd love to get input from @ryanflorence on recommended approach. I want to use loaders and actions and continue using redux as is, a rewrite would be a huge blocker. |
It works like a charm, even got code splitting with routes and reducers working |
I've got RRD V6 working with unstable_HistoryRouter - obviously not ideal and i'll be looking for a long term solution before production, but thought i'd share:
|
@elmarti using actions and loaders? |
@elmarti , @kale1d0code , I tried using HistoryRouter as a replacement of BroswerRouter but in that repo, we use connected-react-router package insteadof redux-first-history and it fails. Need to check, how i can migrate to redux-first-history package first. But, can you guys confirm if history-router from React Router 6.20 is working well with redux-first-history? |
After replacing connected-react-router with redux-first-history, i am facing the same issue reported by @bobsilverberg as of Oct 26, 2022. The last thing i am going to try is to downgrade to 6.4.2 and check if it works or not.
|
@CarreraPHP 6.2 and probably even 6.4 works, just the loaders and actions do not work because you need a specific router for that. |
I've created the following gist which I hope will help |
@salvoravida thanks for the nice library. Can you please make this library support 6.4+ officially? |
Greetings! You may be interested in my project: https://github.com/cha0s/redux-data-router |
Hey team - was just wondering if there's any planned support for
react-router
v6.4.0?After attempting to migrate to their newer method of wiring up routes, it appears it requires a whole new provider to be used, which doesn't seem to require creating the
history
instance to provide it - I'm assuming it now does it internally. Not too sure what changes would be required withinredux-first-router
to support this new way of wiring up the router, but at present due to the internal abstraction ofhistory
withinreact-router
's new API it doesn't seem to be possible to integrate it withredux-first-history
.Any updates on this would be greatly appreciated 🙏
The text was updated successfully, but these errors were encountered: