Skip to content

Commit

Permalink
Remove rAF fork
Browse files Browse the repository at this point in the history
**what is the change?:**
Undid facebook#12837

**why make this change?:**
We originally forked rAF because we needed to pull in a particular
version of rAF internally at Facebook, to avoid grabbing the default
polyfilled version.

The longer term solution, until we can get rid of the global polyfill
behavior, is to initialize 'schedule' before the polyfilling happens.

Now that we have landed and synced
facebook#12900 successfully, we can
initialize 'schedule' before the polyfill runs.
So we can remove the rAF fork. Here is how it will work:

1. Land this PR on Github.
2. Flarnie will quickly run a sync getting this change into www.
3. We delete the internal forked version of
   'requestAnimationFrameForReact'.
4. We require 'schedule' in the polyfill file itself, before the
   polyfilling happens.

**test plan:**
Flarnie will manually try the above steps locally and verify that things
work.

**issue:**
Internal task T29442940
  • Loading branch information
flarnie committed Jun 11, 2018
1 parent 1594409 commit 4c7dd71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 47 deletions.
17 changes: 16 additions & 1 deletion packages/react-scheduler/src/ReactScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,32 @@ type CallbackConfigType = {|

export type CallbackIdType = CallbackConfigType;

import requestAnimationFrameForReact from 'shared/requestAnimationFrameForReact';
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
import invariant from 'fbjs/lib/invariant';
import warning from 'fbjs/lib/warning';

import warning from 'fbjs/lib/warning';

if (__DEV__) {
if (
ExecutionEnvironment.canUseDOM &&
typeof requestAnimationFrame !== 'function'
) {
warning(
false,
'schedule depends on requestAnimationFrame. Make sure that you load a ' +
'polyfill in older browsers. https://fb.me/react-polyfills',
);
}
}

// We capture a local reference to any global, in case it gets polyfilled after
// this module is initially evaluated.
// We want to be using a consistent implementation.
const localDate = Date;
const localSetTimeout = setTimeout;
const localClearTimeout = clearTimeout;
const localRequestAnimationFrame = requestAnimationFrame;

const hasNativePerformanceNow =
typeof performance === 'object' && typeof performance.now === 'function';
Expand Down
10 changes: 0 additions & 10 deletions packages/shared/forks/requestAnimationFrameForReact.www.js

This file was deleted.

24 changes: 0 additions & 24 deletions packages/shared/requestAnimationFrameForReact.js

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/rollup/forks.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,6 @@ const forks = Object.freeze({
return null;
},

// This logic is forked on www to use the 'acrossTransitions' version.
// This will be removed soon, see internal task T29442940
'shared/requestAnimationFrameForReact': (bundleType, entry) => {
switch (bundleType) {
case FB_WWW_DEV:
case FB_WWW_PROD:
return 'shared/forks/requestAnimationFrameForReact.www.js';
default:
return null;
}
},

'shared/ReactScheduler': (bundleType, entry) => {
switch (bundleType) {
case FB_WWW_DEV:
Expand Down

0 comments on commit 4c7dd71

Please sign in to comment.