Skip to content
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

Add support for Suspense & lazy() to the react-is package #14423

Merged
merged 2 commits into from Dec 12, 2018

Conversation

pleunv
Copy link
Contributor

@pleunv pleunv commented Dec 12, 2018

The "react-is" package appears to lack checks for React.Suspense & React.lazy(). Since libraries like enzyme depend on this to implement proper support for these element types I figured I'd take a stab at adding them.

I ran into some yarn test related issues on the way, as I seem to be unable to run the whole test suite (on Windows), only a yarn test --watch ReactIs does the trick. Should I file an issue for this?

@sizebot
Copy link

sizebot commented Dec 12, 2018

Details of bundled changes.

Comparing: ce43a8c...ba0c834

react-is

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-is.development.js +5.0% +2.8% 7.69 KB 8.07 KB 2.38 KB 2.44 KB UMD_DEV
react-is.production.min.js 🔺+5.2% 🔺+3.5% 2.18 KB 2.3 KB 875 B 906 B UMD_PROD
react-is.development.js +5.1% +2.9% 7.5 KB 7.89 KB 2.33 KB 2.4 KB NODE_DEV
react-is.production.min.js 🔺+6.4% 🔺+3.6% 2.16 KB 2.29 KB 815 B 844 B NODE_PROD
ReactIs-dev.js +6.4% +4.1% 5.91 KB 6.29 KB 1.62 KB 1.68 KB FB_WWW_DEV
ReactIs-prod.js 🔺+6.9% 🔺+3.7% 4.42 KB 4.72 KB 1.13 KB 1.17 KB FB_WWW_PROD

Generated by 🚫 dangerJS

Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks 👍

@@ -152,6 +156,14 @@ describe('ReactIs', () => {
expect(ReactIs.isMemo(Component)).toBe(false);
});

it('should identify lazy', () => {
const Component = () => React.createElement('div');
const lazyComponent = React.lazy(() => Component);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This should actually be React.lazy(() => ({default: Component}); but that doesn't matter for the purposes of this test.

@bvaughn bvaughn merged commit a22880e into facebook:master Dec 12, 2018
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
n8schloss pushed a commit to n8schloss/react that referenced this pull request Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants