You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discovered while writing a simple browser test - if you provide preloadState to createStore and you have the Redux Devtools middleware in your store then an error will occur, as for some reason devtools will call the reducer with the raw state not the optimistic state and an @@INIT action. Removing the Devtools middleware from the store makes the error go away.
This is similar to the error I found in #22, except that error was about initialState in the reducer and not preloadState in the store. This error occurs in versions with and without my fix, however adding the @@INIT action to the if statement that checks for @@redux/INIT also makes this error go away, but I'm not sure that's the right thing to do so I'm still looking into it.
The text was updated successfully, but these errors were encountered:
I think I found it - the Redux Devtools Instrumentation implements it's own history system (eerily similar to redux-optimistic-ui!), it has an @@INIT action which ends up calling this function with the preloadState value which causes the wrapped reducer to be passed the original state.
replace the init action check with a check that if the state passed in doesn't have a history array & current property then pass it through createState. This should also cover the @@redux/INIT case (and any other middleware out there that might do something weird like this @@INIT action).
I'll add a repro test and work out the best way to fix it.
Discovered while writing a simple browser test - if you provide
preloadState
tocreateStore
and you have the Redux Devtools middleware in your store then an error will occur, as for some reason devtools will call the reducer with the raw state not the optimistic state and an@@INIT
action. Removing the Devtools middleware from the store makes the error go away.This is similar to the error I found in #22, except that error was about
initialState
in the reducer and notpreloadState
in the store. This error occurs in versions with and without my fix, however adding the@@INIT
action to theif
statement that checks for@@redux/INIT
also makes this error go away, but I'm not sure that's the right thing to do so I'm still looking into it.The text was updated successfully, but these errors were encountered: