ctrlplusb / react-async-component

Resolve components asynchronously, with support for code splitting and advanced server side rendering use cases.
MIT License
1.45k stars 62 forks source link

Combining with <link rel="prefetch" /> results in loading async components twice #77

Open doque opened 6 years ago

doque commented 6 years ago

Hello,

first off thanks for this framework, I love the simplicity and especially the thorough documentation how to add this. We're using it together with react-universally and it's awesome.

But I'm having a small issue while trying to optimize requests to the server. I've got all my bundles set up, the lazy loading works fine: amain bundle that contains a login screen and a "main" view, then I've got a config bundle which is lazy-loaded when navigating to the settings page).

Then, funny things happen. The prefetch seemingly is done, but Chrome (Canary Build) ignores the response (I was able to reproduce this with FF also, where the response was fine, so I'm blaming Chrome for this):

image

Then, navigating to the settings page results in the supposedly prefetched bundle to be loaded again and, while being loaded, I'm presented with a flash of white nothing (which I'm assuming is due to the loadingComponent of null being rendered in the meantime).

Any ideas how to tackle this?

Thanks for your help!