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

React 16 Errors #58

Closed bradennapier closed 6 years ago

bradennapier commented 7 years ago

Just tried an update to React 16 and it would appear an error with async component makes the app fail to load :(

warning.js:36 Warning: Failed child context type: Cannot read property 'asyncComponentsAncestor' of undefined

Says it is only a warning but my app no longer loads at all and this is the only error I can see..

bkniffler commented 7 years ago

I think you forgot to use AsyncProvider on your client bundle.

bradennapier commented 7 years ago

it says not to use that / it is pointless unless you are using SSR which I am not.

bkniffler commented 7 years ago

Did you try using it? When I forgot to add it (I'm using SSR) I had the same issue, after adding it, the issue was gone.

ctrlplusb commented 7 years ago

Damn that may be a bug then

bradennapier commented 7 years ago

Yeah it is just a warning... it is not actually breaking my app - something else was (having any module that forgets to set react as peer dependency will now pretty much break an app with no real reporting).

I fixed this by adding the provider... it seems that react just adds that warning now if it sees any violation of context types.

Not sure what to do in cases like this when the provider is actually optional...

maxmantz commented 7 years ago

Got the same warning and confirm that adding AsyncComponentProvider will fix it.

codeBelt commented 6 years ago

I am using React 16 and not seeing the issue on my repo hapi-react-hot-loader-example. I am using AsyncComponentProvider on both my client-side and ssr code.

ctrlplusb commented 6 years ago

FYI, I have a fix for the warning in progress. 👍

ctrlplusb commented 6 years ago

Fix is queued in master, should be released shortly.