Migration to redux simple router and async-props#833
Migration to redux simple router and async-props#833quicksnap merged 10 commits intoerikras:masterfrom
Conversation
|
Looks like the build is failing.. |
|
@quicksnap Do you mean npm run build ? |
|
The Travis builds are failing, that is. They're at the bottom of this comment thread. |
|
@quicksnap , yeah, I'm going to fix it after ryanflorence/async-props#42 will be merged |
|
@sars that's a nice helper the resolver addition. i'm wondering if they'll be amenable to merging it. |
|
just had a look through this PR and it provides a nice lean update for this project to react-router 2.0 and replacing custom serverside fetching with something more tightly integrated with ongoing development there. it accomplishes much of what universal-redux does (#759) apart from updating to Babel 6, which has another proposal (#778). i still think there's value in depending on universal-redux to easier rise with the tide of future developments and provide a configurable base for those using this as a starting point, but that conversation can be independent of merging this one. in fact, this aligns RRUHE closer to UR, and would ease the migration path. |
|
line 15 of src/server.js has a reference to redux-router that needs to be removed for it to build |
package.json
Outdated
There was a problem hiding this comment.
This needs to be upgraded to 0.20.x
From react-router-bootstrap README.md:
Note: Releases from v0.20.0 onward only support React Router v2.x....
|
I'm trying to port this PR to my code. To be able to run |
|
I had a PR out to fix this ryanflorence/async-props#36 But at this point I think they want to stay out of the build tool jungle. I ended up pulling async-props source directly into universal-redux in order to support it. |
|
Have a look, guys, please @erikras, @bdefore If you want, I can create for your projects... |
|
@sars that would be great, thanks! |
|
@quicksnap , @erikras , going to redo this pr with redux-asyc-connect today. it should be good |
|
@jakegibson , thank you for comments
done
done
done @quicksnap , @erikras , please, have a look. I did not use all features from redux-async-connect here to keep diff as small as possible... |
|
💪 waiting for it. I'll try it on my project |
|
there is some problem with test: but i don't see how this is related to PR |
|
@sars, great PR, just one question. When the widget fails to load (33%), the widget page keeps waiting for a response and will never load. Do you have any solution for that? |
|
Oh yes, i fixed tests :) |
|
@lemonCMS fixed in async connect 0.1.4 |
|
This is gorgeous. 👍 Great work, @sars! |
|
I noticed you removed |
|
@erikras thanks for comments I don't completely understand what scroll-behavior lib does... |
|
@sars when the route changes depending on witch scroll-behavior you have implemented, the page scroll to the top. Without this, the scroll position stay's the same. But indeed, not yet compatible. |
Better initialization of react router redux on server-side (with original url)
|
@quicksnap Rebased |
|
👍 |
|
@sars sorry to do this to you, so close! I found a bug that is due to removing this line: https://github.com/erikras/react-redux-universal-hot-example/pull/833/files#diff-e6a5b42b2f7a26c840607370aed5301aL97 Now query params are not set on the location. I don't know if that's a problem with us here or a problem with react-router-redux not picking up on the location. |
|
@mmahalwy I used react-router/lib/createMemoryHistory https://github.com/erikras/react-redux-universal-hot-example/pull/833/files#diff-e6a5b42b2f7a26c840607370aed5301aR17 |
|
@sars hmm weird, I must have had your old changes. You're right! Works perfectly :) |
|
Guys, take a look please at new version of redux-async-connect brocoders/redux-async-connect#16 (comment) Documentation is in progress... But it solves several significant issues: router in params, ability to define something like deferred props, etc. |
several modules updated
|
scroll-behavior works now! |
src/redux/create.js
Outdated
|
|
||
| export default function createStore(reduxReactRouter, getRoutes, createHistory, client, data) { | ||
| const middleware = [createMiddleware(client), transitionMiddleware]; | ||
| export default function createStore(getRoutes, history, client, data) { |
|
@farrrr |
|
@quicksnap , I think it looks quite stable for merging to master.... what do you think? |
|
I want this so bad in master branch |
|
It feels stable to me. I've been using it in our product and haven't had much problems. Here goes nothing! |
Migration to redux simple router and async-props
|
BAM Sent from my Tricorder
|
|
😱 OMG 👏 |
|
this is great, nice work guys! thanks! |
|
this is great works folks! would it be possible for someone involved in the PR to write a couple of bullet points as a guide on what has changed conceptually and how (essentially, how to migrate)? I suspect a lot of people who have been using this boilerplate and have done a lot of subsequent work would want to absorb these changes, and quick explanation on the changes would be very helpful! thanks again everyone involved with it! |
|
@oyeanuj Agreed, feel that would help allot of people out. |
|
Don't we need to change the requireLogin method in routes.js as well? const requireLogin = (nextState, replaceState, cb) => {
function checkAuth() {
const { auth: { user }} = store.getState();
if (!user) {
// oops, not logged in, so can't be here!
replaceState(null, '/');
}
cb();
}
if (!isAuthLoaded(store.getState())) {
store.dispatch(loadAuth()).then(checkAuth);
} else {
checkAuth();
}
};to const requireLogin = (nextState, replace, cb) => {
function checkAuth() {
const { auth: { user }} = store.getState();
if (!user) {
// oops, not logged in, so can't be here!
replace('/');
}
cb();
}
if (!isAuthLoaded(store.getState())) {
store.dispatch(loadAuth()).then(checkAuth);
} else {
checkAuth();
}
}; |
|
@oyeanuj +1 for a guide. This looks much cleaner but I need some clear instructions on how to migrate these changes. |
|
Guys, I'll try to create something like migration doc, but to be honest it's not so obvious. If you look at diff from this PR, you find all changes. |
|
@oyeanuj will do shortly |
No description provided.