-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug_session / black list actions effects #177
Comments
Could you please give more details about those actions? What do you use for side effects?
|
yes definitely, I expressed myself wrongly using the sentence "side effects" lets say I have a list or "tabs" which will be fetched by an api call triggered on const tabs = (state = [], { type, payload }) => {
switch(type) {
case FECTH_TABS_DONE:
return payload.tabs.map(tab => ({
...tab,
active: false,
}));
default:
return state;
}
} As shown above I have an active flag, which I use in order to highlight/show the current tab in my app...which allows me to have a const tabs = (state = [], { type, payload }) => {
switch(type) {
case FECTH_TABS_DONE:
return payload.tabs.map(tab => ({
...tab,
active: false,
}));
case SET_TAB_ACTIVE:
return state.map(tab => ({
...tab,
active: payload.id === tab.id,
}));
default:
return state;
}
} So my goal with the issue that I am facing is that if I reload the app the persisted state will be inject properly, but |
I see. A solution was introduced in I will add more details in the docs. Related to #140. |
that's great! thanks for clarifying that for me 👍 |
There's a better way now to prevent side effects like those while time travelling. See the post for details on how to get it. |
I might have an interesting case with
debug_session
, giving the following example:My app has a chunk of initial data fetching like:
So when I add
debug_session=foo
it will persist my state, but after reloading those actions willbe dispatched again and my reducers will process this as it should on the initial page load, bringing
my app to its "initial state".
With this case, I can't really take an advantage of the state persistence feature 😢
a solutioncould be having a list of actions which will be "skipped" (non-side effects) for the givingdebug_session
or something similar...(I found this issue, but I am not sure if we were talking about the same problem)
The text was updated successfully, but these errors were encountered: