erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
11.99k stars 2.5k forks source link

requireLogin not working for first time rendering when disable SSR #430

Open kafaichoi opened 9 years ago

kafaichoi commented 9 years ago

When I go to chat page by typing in browser location, the requireLogin hook is not called.

I guess it is because there is not store yet when the safeOnEnter hook get called for the first time rendering.

shalomeir commented 9 years ago

Me too. I've tried to fix or ignore 'makeRouteHooksSafe'. But I couldn't make it. I hope to catch up this issue. It's very serious problem for me. Plz anyone follow up.

laurenskling commented 8 years ago

I finally found out I had this too, used some of the code from this repo, but not SSR; initial page loads don't go over onEnter, which is a real no go to me! Not sure if it's a problem with this repo or with react-router/redux-router yet. Let's keep each other informed.

update: Switching to redux-simple-router directly fixes this problem. (any no hacky MakeRouteHooksSafe) https://github.com/jlongster/react-redux-universal-hot-example/commit/e13b93518c8c9b5524ad50f1c566ed6c480c1888?diff=split Don't know yet if it will break anything else to use this other library; but this discussion seems like the demise of redux-router anyway: https://github.com/rackt/redux-router/issues/172

shalomeir commented 8 years ago

@laurenskling Wow. Your comment is very helpful to me. Recently I was eliminating MakeRouteHooksSafe middleware temporarily. And I change function that called by onEnter provision against when store or dispatch is not working. But this is not a good solution. So I'm glad to hear that your proposal. Thanks.

quicksnap commented 8 years ago

Linking to https://github.com/jlongster/redux-simple-router/issues/13