React-redux-universal-hot-example: ReduxAsyncConnect fires in Client Side when it shouldn't

Created on 16 Mar 2016  路  8Comments  路  Source: erikras/react-redux-universal-hot-example

While using boilerplate i found some problem.
In reduxAsyncConnect I'm using getData() from my reducer, which loads some info from db. Later, I have a button, that changes one of returned values, but the value remain unchanged for the first time. Clicking second, third, etc. time it works perfectly correct. I think that I found where the problem is - clicking on button, which fires another function from reducer, trigggers some other actions - including "@@router/UPDATE_LOCATION", "reduxAsyncConnect/BEGIN_GLOBAL_LOAD" and "reduxAsyncConnect/END_GLOBAL_LOAD". Also it fires my action that is in reduxAsyncConnect, which causes reseting my reducer to initial state.

It can be checked even on clean boilerplate - all you need to do is to add console.log(action.type) in, for example redux/modules/widget.js and clicking in counter button on home page, shows all these actions, which shouldn't fire on clicking button!

One more info I found - such thing happens only if it's first action we do on page that was loaded from ssr. If we change page and return to home, none of previous functions is firing on clicking button.

Most helpful comment

@cjroebuck 's workaround works.

Just upgrade to react-router-redux@4, and update some files following this PR:

https://github.com/erikras/react-redux-universal-hot-example/pull/951/files

All 8 comments

+1

+1 redux-async-connect seems too unstable, I also faced as issue where data-checksum is not generated, and client.js returns a error if App Component is not connected using asyncConnect

+1 Just faced this issue. This issue seems to be relevant https://github.com/bdefore/universal-redux/issues/91

A workaround for me is to fire blank action at componentDidMount of the App component

+1

+1. also @PanJ your workaround doesn't work for me. just causes the problem to happen earlier, when the App component mounts rather than on the first action fired.

Issue seems to go away by upgrading to react-router-redux 4.x.x

@cjroebuck 's workaround works.

Just upgrade to react-router-redux@4, and update some files following this PR:

https://github.com/erikras/react-redux-universal-hot-example/pull/951/files

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eromoe picture eromoe  路  5Comments

chrisabrams picture chrisabrams  路  5Comments

yesmeck picture yesmeck  路  3Comments

IljaDaderko picture IljaDaderko  路  4Comments

massimopibiri picture massimopibiri  路  5Comments