-
Notifications
You must be signed in to change notification settings - Fork 66
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
Lazy component load #118
Comments
redux-connect can not be used with react-loadable, because of these lines: redux-connect/modules/helpers/utils.js Line 105 in cedd35b
redux-connect/modules/helpers/utils.js Lines 81 to 89 in cedd35b
redux-connect should allow to preload the missing files before fetching all the function getComponents(match /* the result of matchRoutes */ ) {
return match.map(v => v.route.component).reduce(async (result, component) => {
if (component.preload) {
const res = await component.preload();
const ret = [...(await result), component, ...[].concat(res)];
return ret;
}
return [...(await result), component];
}, []);
} |
You are very welcome to provide a PR with this as a non-breaking feature, such as custom component preloading, however async/await would require too much of extra payload, so please refrain from using it and just exploit regular promises Thanks! |
Wrote a comment here #116, could it not be possible if you write your own helper preparing the route-config for redux-connect, you dont need to give it the "original" route-config, but rather a enhanced one where you map the component-field for each field, and if its a async function you add it to a promise.all and when this is done you pass a config with loaded components so redux-connect can reach the static loading-function? |
@AVVS Hey Vitaly! Any ideas on how to make it compatible> |
Does this library allow me to connect lazy loaded (with webpack) component to reducer?
The text was updated successfully, but these errors were encountered: