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

Remove 'warning' module from the JS scheduler #13264

Merged
merged 3 commits into from
Jul 25, 2018

Conversation

flarnie
Copy link
Contributor

@flarnie flarnie commented Jul 24, 2018

what is the change?:
See title

why make this change?:
Internally the 'warning' module has some dependencies which we want to
avoid pulling in during the very early stages of initial pageload. It is
creating a cyclical dependency.

And we wanted to remove this dependency anyway, because this module
should be kept small and decoupled.

test plan:

  • Tested the exact same change internally in Facebook.com
  • Ran unit tests
  • Tried out the fixture

issue:
Internal task T31831021

Before submitting a pull request, please make sure the following is done:

  1. Fork the repository and create your branch from master.
  2. Run yarn in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (yarn test). Tip: yarn test --watch TestName is helpful in development.
  5. Run yarn test-prod to test in the production environment. It supports the same options as yarn test.
  6. If you need a debugger, run yarn debug-test --watch TestName, open chrome://inspect, and press "Inspect".
  7. Format your code with prettier (yarn prettier).
  8. Make sure your code lints (yarn lint). Tip: yarn linc to only check changed files.
  9. Run the Flow typechecks (yarn flow).
  10. If you haven't already, complete the CLA.

Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html

**what is the change?:**
See title

**why make this change?:**
Internally the 'warning' module has some dependencies which we want to
avoid pulling in during the very early stages of initial pageload. It is
creating a cyclical dependency.

And we wanted to remove this dependency anyway, because this module
should be kept small and decoupled.

**test plan:**
- Tested the exact same change internally in Facebook.com
- Ran unit tests
- Tried out the fixture

**issue:**
Internal task T31831021
@flarnie
Copy link
Contributor Author

flarnie commented Jul 24, 2018

Another alternative is to move the polyfill check up into React, but seems like it makes sense to bake that in imo. Because the schedule module won't work without rAF, and it will eventually be available without React.

@pull-bot
Copy link

pull-bot commented Jul 24, 2018

Details of bundled changes.

Comparing: ca0941f...da1873a

react-scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-scheduler.development.js -7.5% -9.2% 16.65 KB 15.39 KB 5.11 KB 4.64 KB UMD_DEV
react-scheduler.development.js -7.6% -9.2% 16.46 KB 15.2 KB 5.06 KB 4.6 KB NODE_DEV
ReactScheduler-dev.js +0.2% -0.1% 15.39 KB 15.42 KB 4.64 KB 4.64 KB FB_WWW_DEV
ReactScheduler-prod.js -0.2% -0.6% 7.59 KB 7.58 KB 1.91 KB 1.89 KB FB_WWW_PROD

Generated by 🚫 dangerJS

@gaearon
Copy link
Collaborator

gaearon commented Jul 25, 2018

Should we keep this check?

if (typeof console !== 'undefined') {

'Make sure that you load a ' +
'polyfill in older browsers. https://fb.me/react-polyfills',
);
if (__DEV__ && typeof console !== 'undefined') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: we tend to put DEV check in its own separate if block, and then nest another if (when necessary). Makes DEV conditions stand out more

@flarnie flarnie merged commit 0154a79 into facebook:master Jul 25, 2018
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