-
Notifications
You must be signed in to change notification settings - Fork 200
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
Future of redux-router: redux-simple-router? #172
Comments
Also feel free to ping @omnidan or me (@Scarysize) in the redux-router Discord channel or pm us! |
Let me know whatever you all want to do. I don't think there's anything wrong with having 2 solutions, but whatever works. I can help with any transitions plans if needed. |
Unless we find enough people who can (together) actively maintain redux-router, it's going to be problematic. @Scarysize is doing good work, but there's so many issues with the current implementation. (He can probably explain this in further detail) I like how redux-simple-router is small, simple and easy to maintain. If anyone has switched to redux-simple-router, would be nice to hear experiences, thoughts, etc. Would be really cool if we could get a "Switching to redux-simple-router" guide up. |
I just switched to using redux-simple-router in my current project at work and it has been seamless so far. It is a small project which doesn't ask a lot of the router, so I might not be hitting the cases where redux-router is the superior choice. As @jlongster says, it is 'ruthlessly simple'. I can understand everything it is doing, so I can be comfortable using it in a project even though it is less than a week old. There is one thing that I know of that redux-simple-router does currently that redux-router does not, and that is work correctly with redux-devtools (I don't think that version of redux-simple-router is on NPM yet, but I imagine it will be soon) |
Disclaimer: I haven't actually built anything with redux-router or redux-simple-router yet, but I've been trying to stay up to date on where it's going (I plan to overhaul my routing code soon to use react-router 1.0 and I'm looking to use one of these two solutions). So please forgive my ignorance if anything I write here is inaccurate. From the docs, it sounds like redux-simple-router only stores a Similarly, I want to be able to easily check if a given route is active or not based on the information stored in my reducer state. Redux-router has such a capability, and I'd prefer to avoid having to use anything too browser-specific to check this information, since it can really be expressed as a "pure" function of the state. Anyway, in many ways I like idea of building something simple on top of react-router (because it makes maintaining the library much easier), but at the same time I also like the goals of redux-router to avoid having any real dependency on React (and just treating the route state as any other redux state). It's a tough call, but at the end of the day I just want a simple way to keep my route state in sync with some convenient ways to update and check the status of that state. How pure, minimal, or decoupled the underlying implementation is doesn't matter much to me in any practical sense because I'm already using React, react-router, and redux anyway 😄 |
redux-simple-router is a cool project. It's pretty similar to what Redux Router (then redux-react-router) was in its earliest version. It benefits from being less ambitious — Redux Router tries to store all the router state, including params, inside your Redux store. There's an argument that Redux Router is overly ambitious given the current design of React Router. I've already done some work to help with this — the For now I'd say both libraries can continue to co-exist. I would like to give more attention to this library, but I just haven't found the time recently. Hopefully soon. |
Another reason I've neglected this project recently is that I haven't been using it heavily in the project I'm working on, which uses Relay. I wish I had infinite time for OSS, but it turns out I spend what time I have on projects that I'm actively using. Sorry :( I'll try to be a better OSS citizen going forward, and not start projects that I can't devote sufficient time to. |
Hey, please don't feel guilty for starting an open source project! We all appreciate the work you put into this, and open source projects don't always work out the way we want them to. (I'm screwing people over with not updating React Transform for so long too—like you, I don't find time to contribute in the past weeks because I'm busy with other stuff.) If you don't think you can handle this project at the current stage, I think we'd all benefit from a little “state of affairs” summary, if you can find time to write it up. Basically: what your goals were, what makes them harder to achieve on RR side, tradeoffs of other approaches you saw in the wild, and recommendations you can give us with moving forward. If you don't have time to write it up, maybe we can chat for 30 minutes some day on the week and you can give me an idea verbally so I can write it up myself. Most importantly, don't burn out. 👍 |
@gaearon @acdlite Agreed! Definitely not wasted work (just look at how your changes and thought process has shaped the 1.0 react-outer API). Plus, this project has put forth some great ideas about how to handle route state in redux. I'd definitely consider it a key part in the evolution of building redux/react applications. I also agree that a "state of affairs" kind of post would be beneficial. Sometimes it's hard to know where and when to step in with a seemingly-stagnant OSS project, because frequently the author has thoughts and ideas that the general public just isn't aware of (as we both know, a lot of the best "programming" often times takes place inside one's head, away from the keyboard, while laying in bed or taking a shower 😄). Even if it's just a "hey, I don't have the time or resources to work on this anymore" there is no need to feel bad - it just gives others an opportunity to step in where you left off! |
FWIW, I had been struggling to get redux-router working in a universal app for the past 2 days, running into multiple issues (documenting issues, dependency issues, etc.) I saw this thread and gave redux-simple-router a go, and had it working in less than 2 hours. |
I agree about both library co-existing. I wasn't trying to take anything away from this project at all, and I'm sure there's some good things to be learned from it. I thought about contributing to it, but I wanted to try such a different approach that I didn't really see how without starting a new library. The main problem I have with this library is that it stores everything in redux, which makes it not serializable, which is really crucial. And I really like react-router's API. I don't think we should move too fast, there might be people out there who like this a lot better so we can just give it time to see if more people will help maintain this and solve those people's problems. I'm all for choices. |
Thanks for all the feedback 😄 Keeping both libraries sounds like a good plan - all we need to do now is get more people to contribute actively to redux-router (at the moment there are more issues opened every day than @Scarysize manages to look at / fix / close!) 😅 I agree that writing a "state of affairs" summary would be nice, it would also help @Scarysize and me make decisions for redux-router without having to ask @acdlite all the time. @acdlite Don't feel bad, that's the point of open source projects - when you can't maintain them anymore, the community will join in and work on it. With proprietary projects that's not possible and the project would just die. @idolize You can probably use some other library to convert the string to an object, but I still get your point. @jlongster I totally agree with you, I opened this issue for this exact reason - I honestly didn't know what the best way to handle it would be, and I haven't used redux-simple-router yet so I couldn't tell if it's missing something that redux-router has or what switching feels like. Switching guides would still be cool as some people might start out using redux-router and then realize redux-simple-router is a better solution, but also the other way around! If anyone is interested in contributing, feel free to ping us in the discord channel! 😁 |
This commit was a good switching guide for me to go from Like @kmudrick I was having issues getting |
I like the "redux-simple-router" approach more, especially this:
By doing this, it's much simpler to stay "in sync" with new versions of react-router and also reduces a lot of complexity. However, I would like to see these two libraries combined to maintain the redux ecosystem simpler. Sorry if my vision is wrong 😅 Maybe some questions to help it:
|
That was my idea too, but it's really hard to combine them, as both libraries have totally different approaches. |
We currently use
If I really appreciate the work that @acdlite (et al.) has done (in |
FWIW, you can do everything in both libraries. I'm not trying to say which is better, but the only different is API. redux-simple-router has an action you can fire I think some people are confused that redux-router implements these features, but really react-router is the one that implements most of the work and this project was trying to re-expose the API in a redux way. But that is complicated, and redux-simple-router just tells you to use react-router APIs directly. I'm going to add more examples to the project, but for now you can check out the port of react-redux-universal-hot-example. |
I really, really don't want to come across as confrontational. @acdlite and others have done great work. This is a great project and I'm sure a lot of people like this API better! But I saw an opportunity to do it differently so I'm just throwing it out there. |
see here for more info acdlite/redux-router#172
Soooo, before this thread gets lost in the issues abyss. I will just throw in some ideas: How can make it easier for people to contribute?I think this a big issue (badumtss). There are a lot of contributions, but for very specific problems people are dealing with and fixing themselves. A lot of major issues won´t really get tackled, because firstly, there are workarounds, secondly nobody cares about an issue if they aren't affected by it and thirdly it is like REALLY confusing and hard spot what the exact issue is and were to start fixing it. There are maybe 3-4 separate issues for maybe the same problem...maybe not, it´s hard to tell.
On a side note: I am really thankful for every contribution and am kind of sad, that I don´t have the time to contribute (and im talking code) to this great project. I´m keeping up with issues, trying to point people in the right direction for their problem, but as mentioned above there isn´t anyone really working on fixing major issues or adding new features. What´s your grasp on this? Let us know! |
I'm going to throw my 10 cents into the ring. I have been using redux router quite a bit and I have been really loving it's more in-depth integration with react-router. I have found many use cases where taking advantage of it's closer integration with the history module has allowed me to to create code that makes sense. I too am interested in seeing this module continue to evolve. I would not want to see it die. |
Just re-read this thread again, and I'm in the same boat as @nickpresta. We have found redux router incredibly helpful in our app, and we are using all the things he mentions. These are all things not really offered by redux-simple-router. |
I came here from a Hacker News thread about redux-simple-router to pretty much echo what I said there, which is to suggest that a hard dependency on React be avoided. I (and plenty of others) use Redux without React and as such would appreciate that same agnostic approach be extended to the ecosystem being built around Redux. Luckily, there are no down-vote buttons on Github so my comment might actually be seen here :-P |
Hey everyone we are using Redux-router currently in our application soon to be launched (neighborhoods.com). I (and our other front-end engineer) would love to really contribute to this moving forward but prior to launch there is not much we can do! After holidays I will be back on to help out...thanks for all the effort guys. |
@zrosenbauer that's great to here. If you have any questions you can just message us on Discord |
I'd like to throw out a suggestion I've thought about after porting an app from I think one thing that would be very beneficial would be to move the constants, actions, and middleware related to the historyApi into its own module because this could easily be used side by side with |
I've been very happy with redux-simple-router, the only issue currently is the bug in google chrome for IOS that makes browserHistory not work. |
I use redux-router in my app and one thing I really like is that I can use router params from state in my reselect selectors. |
I'm just wondering what the current status of this project is. Has the redux community settled on react-router-redux as the standard? Sorry if this has already been answered somewhere else. |
@jcheroske I guess there are a few projects left, which use redux-router because react-router-redux hasn´t been released yet, when they started. Also I think most people realize, that most of the time react-router is enough for your app and you don´t need redux bindings. If you aren´t at a point where your REALLY need bindings, I would recommend not adding another dependency to your project. Otherwise For the current state: As there are no major issues, nobody is working on anything. If something arises, we always try to solve it quickly. Also I´m trying to figure out if people are using the 2.0 version and, depending on feedback, merge this into the master branch. |
Thank you, @Scarysize, for the in-depth heads-up. My project is in its initial stages, and I'm not actually sure if my requirements call for the router state to be in redux, but I can't help but think I'd like to just put it in there anyway. I've written a small module that generates various actions when certain reactive data changes in Meteor. For example, whenever the status of the logged-in user changes, an action is fired and the store state is mutated. Now I'd like to go beyond just importing the Meteor state into redux, and actually create some behavior. Can you (or anyone else here) suggest an approach and/or one of the redux router libraries for the following bit of functionality?
There will be an action fired when the user is logged out, and there will be store state that also indicates there is no user. What is the best way to do this? I'm thinking that using a saga might be best, but maybe just subscribing to the store state would be better. Honestly, I am so new to redux that I have no idea what's an anti-pattern. Does this use-case warrant having the router state in redux? |
@jcheroske you should check out my small HOC library for helping with authentication and redux. It supports both |
@Mjrussel, thank you for the tip, and for the library! Let's continue the discussion over there. |
@Scarysize What does the beta8 tag indicate now? Its been 6 months, hence the question. Is it just more of a formality, or are you planning to make more changes before calling it v1 done? |
@oyeanuj No, I don´t think there are going to be any changes to the v1 anymore. I will talk to @mjrussell and then I guess we will release the current |
Yeah I agree @Scarysize. Definitely think the React Router 1 supported version should be versioned without the beta tag. Not sure about the React Router 2 version, I don't have any plans to add features to it. Also with semver no one should get an auto upgrade so it's pretty safe to do a 2.0 release with it. |
Also I pushed a separate branch for v1, because it got somehow lost in the v2 commits. |
Recommended reading: http://stackoverflow.com/questions/35665724/with-react-redux-router-how-should-i-access-the-state-of-the-route?rq=1 reduxjs/redux#227 (comment) jlongster/react-redux-universal-hot-example@e13b935?diff=split acdlite/redux-router#172 https://github.com/acdlite/redux-rx#createconnectorselectstate-render https://shellmonger.com/2016/03/08/react-redux-and-routing/ https://blog.risingstack.com/react-js-best-practices-for-2016/ https://github.com/reactjs/redux/tree/master/examples/real-world http://stackoverflow.com/questions/35196873/how-to-use-react-router-redux-routeactions/37494808 http://stackoverflow.com/questions/36722584/how-to-sync-redux-state-and-url-hash-tag-params/36749963#comment61535948_36749963 https://github.com/Automattic/wp-calypso/blob/master/docs/our-approach-to-data.md#third-era-redux-global-state-tree-december-2015---present
Recommended reading: http://stackoverflow.com/questions/35665724/with-react-redux-router-how-should-i-access-the-state-of-the-route?rq=1 reduxjs/redux#227 (comment) jlongster/react-redux-universal-hot-example@e13b935?diff=split acdlite/redux-router#172 https://github.com/acdlite/redux-rx#createconnectorselectstate-render https://shellmonger.com/2016/03/08/react-redux-and-routing/ https://blog.risingstack.com/react-js-best-practices-for-2016/ https://github.com/reactjs/redux/tree/master/examples/real-world http://stackoverflow.com/questions/35196873/how-to-use-react-router-redux-routeactions/37494808 http://stackoverflow.com/questions/36722584/how-to-sync-redux-state-and-url-hash-tag-params/36749963#comment61535948_36749963 https://github.com/Automattic/wp-calypso/blob/master/docs/our-approach-to-data.md#third-era-redux-global-state-tree-december-2015---present
Recommended reading: http://stackoverflow.com/questions/35665724/with-react-redux-router-how-should-i-access-the-state-of-the-route?rq=1 reduxjs/redux#227 (comment) jlongster/react-redux-universal-hot-example@e13b935?diff=split acdlite/redux-router#172 https://github.com/acdlite/redux-rx#createconnectorselectstate-render https://shellmonger.com/2016/03/08/react-redux-and-routing/ https://blog.risingstack.com/react-js-best-practices-for-2016/ https://github.com/reactjs/redux/tree/master/examples/real-world http://stackoverflow.com/questions/35196873/how-to-use-react-router-redux-routeactions/37494808 http://stackoverflow.com/questions/36722584/how-to-sync-redux-state-and-url-hash-tag-params/36749963#comment61535948_36749963 https://github.com/Automattic/wp-calypso/blob/master/docs/our-approach-to-data.md#third-era-redux-global-state-tree-december-2015---present
Recommended reading: http://stackoverflow.com/questions/35665724/with-react-redux-router-how-should-i-access-the-state-of-the-route?rq=1 reduxjs/redux#227 (comment) jlongster/react-redux-universal-hot-example@e13b935?diff=split acdlite/redux-router#172 https://github.com/acdlite/redux-rx#createconnectorselectstate-render https://shellmonger.com/2016/03/08/react-redux-and-routing/ https://blog.risingstack.com/react-js-best-practices-for-2016/ https://github.com/reactjs/redux/tree/master/examples/real-world http://stackoverflow.com/questions/35196873/how-to-use-react-router-redux-routeactions/37494808 http://stackoverflow.com/questions/36722584/how-to-sync-redux-state-and-url-hash-tag-params/36749963#comment61535948_36749963 https://github.com/Automattic/wp-calypso/blob/master/docs/our-approach-to-data.md#third-era-redux-global-state-tree-december-2015---present
Hi I don't know if here is the right forum but this discussion motivated me to write this article http://blog.scottlogic.com/2017/03/09/relogic-2.html and the libraries it describes. Let me know if this message is not appropriate and I will delete it. |
As you may have noticed, this project isn't actively maintained right now.
@jlongster developed a project called redux-simple-router - it is a lot smaller (and thus, easier to maintain) than redux-router. Some people already switched to that.
It seems like a better solution (redux-router re-implements a lot of features that history and react-router already do), so it probably makes sense to combine the projects (read: replace redux-router with redux-simple-router)
What do you think? Is there anything missing in redux-simple-router that redux-router has? Just let me know in a comment here.
PS: I haven't managed to get a hold of @acdlite yet, but once he gets online on discord I'll talk to him about it. (or he can just comment here 😄)
The text was updated successfully, but these errors were encountered: