i have created a container similar to src/components/InfoBar/InfoBar.js which is connected to a reducer ("posts"). the reducer has the "load" method defined just like info.js reducer "module".
i have verified that all the intended data are retrieved from their respective endpoints.
the issue is that depending on what order the "load" methods are called in src\App\App.js, I get the data from last called "load" method.
src\App\App.js
import { isLoaded as isInfoLoaded, load as loadInfo } from 'redux/modules/info';
import { isLoaded as isPostsLoaded, load as getPosts } from 'redux/modules/posts';
import { isLoaded as isAuthLoaded, load as loadAuth, logout } from 'redux/modules/auth';
.......
@asyncConnect([{
promise: ({store: {dispatch, getState}}) => {
const promises = [];
if (!isPostsLoaded(getState())) {
promises.push(dispatch(getPosts()));
}
if (!isInfoLoaded(getState())) {
promises.push(dispatch(loadInfo()));
}
if (!isAuthLoaded(getState())) {
promises.push(dispatch(loadAuth()));
}
return Promise.all(promises);
}
}])
Here is my LOAD_SUCCESS defined in info.js and posts.js (a reducer "module" created by me) respectively
Here is my current state for "info" and "posts"
http://prntscr.com/e02qxi
Can anyone explain why my api call data replaces the previous api call data? And where can I fix it?
i have created a container similar to src/components/InfoBar/InfoBar.js which is connected to a reducer ("posts"). the reducer has the "load" method defined just like info.js reducer "module". i have verified that all the intended data are retrieved from their respective endpoints. the issue is that depending on what order the "load" methods are called in src\App\App.js, I get the data from last called "load" method. src\App\App.js
Here is my LOAD_SUCCESS defined in info.js and posts.js (a reducer "module" created by me) respectively
Here is my current state for "info" and "posts" http://prntscr.com/e02qxi Can anyone explain why my api call data replaces the previous api call data? And where can I fix it?