Closed bfitch closed 6 years ago
A repro would make it easy. Put it on codesandbox if possible.
Check closed issues. Someone else might have had the same issue. ⛩
it's not happening when you add logging to the reducers in the RFR codesandbox:
https://codesandbox.io/s/github/faceyspacey/redux-first-router-codesandbox
i could have checked the redux devtools, but it leaves some actions out, so i wanted to 100% verify, which is why i added console.log to a reducer to check.
In the demo repo, u dont see the SIGN_IN action cuz state is preloaded from the server and the initial action is not dispatched if u have SSR. Since it's being dispatched for u (and if what ur showing is happening on the client), it's cuz u dont have SSR. There still shouldnt be a second @@INIT. But I cant say for sure without seeing a repro. Again, the codesandbox SPA doesn't do it either. So I'm not sure what's happening for u.
here's the demo repo with SSR: notice no initial action dispatched with the route's type.
Here's a quick "repro" on codesandbox using the loginOnlyInProduction compose like you have:
https://codesandbox.io/s/68GGx0y5l
check the console. it's logged. check the redux devtools. the issue isn't happening.
since ur doing the strategy where u do something different on the server than the client, and on the client its still dispatching the initial action at all, it leads me to think ur trying to do SSR, but it's not correctly setup, which may have something to do with it.
Thanks James! Sorry, I should have said this is not SSR, only client side. I will push up a minimal example to repro in a bit (currently 3am in the US 😛).
@faceyspacey Here is a repo with a minimal example showing the issue with the extra "INIT" action with devtools: https://github.com/bfitch/redux-first-router-devtools-issue
/sign_in
in the browser location barcompose
in index.js (removing devtools) and observe that the extra "INIT" action goes away and routing works correctlyThanks for your help!
is this still an issue with the latest versions of RFR? try yarn upgrade redux-first-router@rudy
.
in the upcoming rudy release, dispatching the initial action will be required by the user, so you can guarantee when it's done. currently you can use the initialDispatch: false
option to do so, which returns an initialDispatch()
function along with middleware
, enhancer
, reducer
.
Hi! Thanks for this awesome project. I'm running into an issue with devtools integration where it appears that an extra
@@INIT
action is causing our page state to be erased.I pretty much copy and pasted your example code for the store setup like this:
When navigating to
/sign_in
in the browser's location bar, 5 actions are dispatched to the page reducer:{type: "@@redux/INIT"}
{type: "@@redux/PROBE_UNKNOWN_ACTION_m.q.g.n.b.n"}
{type: "@@INIT}
{type: "SIGN_IN", payload: {…}, meta: {…}}
{type: "@@INIT}
<--- Only dispatches when redux-devtools are enabledThe fifth action is what resets the page state to the default and is only dispatched when devtools are on. Have you run into this problem at all? Any pointers would be greatly appreciated. Thanks!