redux-dynamic-modules
redux-dynamic-modules copied to clipboard
How to wait completion of initialactions when I use a module dependencies?
I have 2 modules.
There are authModule and userPageModule.
authModule is get user login status by initialactions.
userPageModule is used to display the user page using the fetched login status by authModule.
Therefore, I want these modules to be loaded in the correct order.
But looks like userPageModule will be loaded without waiting for initialaction of authModule to complete to me.
Is the order of this process correct? If so, how can I do what I want?
export const authModule = () => {
return {
id: 'auth',
reducerMap: {
auth: authReducer,
},
sagas: [watchAuthUser],
initialActions: [getLoginStatus.start()],
};
};
export const userPageModule = () => {
return {
id: 'userPage',
reducerMap: {
profile: profileReducer,
},
sagas: [watchPage],
};
};
export const UserPage = () => (
<DynamicModuleLoader modules={[authModule(), userPageModule() ]}>
<Page />
</DynamicModuleLoader>
);
const Page = () => (
<>
// some components that use user data
</>
)