More useful DEV error message when lazy-rendering Context Provider
Summary
If you render a createContext().Provider from a lazy(), the error message is difficult to understand:
Error: Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function.
This PR adds a DEV-time hint, following the pattern of the existing one for double-lazy():
Error: Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function. Context Providers cannot be lazily rendered without being wrapped in a component.
How did you test this change?
Added a new test and ran yarn test.
Comparing: 98f3f14d2e06fb785103296318204cd154d5d0ed...4ad8f61db25cc343b308274ec007d2c1de297911
Critical size changes
Includes critical production bundles, as well as any change greater than 2%:
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| oss-stable/react-dom/cjs/react-dom.production.min.js | = | 165.67 kB | 165.67 kB | = | 51.99 kB | 51.99 kB |
| oss-experimental/react-dom/cjs/react-dom.production.min.js | = | 173.16 kB | 173.16 kB | = | 54.21 kB | 54.21 kB |
| facebook-www/ReactDOM-prod.classic.js | = | 570.50 kB | 570.50 kB | = | 100.49 kB | 100.49 kB |
| facebook-www/ReactDOM-prod.modern.js | = | 554.30 kB | 554.30 kB | = | 97.66 kB | 97.66 kB |
Significant size changes
Includes any change greater than 0.2%:
(No significant changes)
Generated by :no_entry_sign: dangerJS against 4ad8f61db25cc343b308274ec007d2c1de297911
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!