Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Replace deferredUpdates usages
Browse files Browse the repository at this point in the history
Summary:
The async mode unstable API deferredUpdates was removed in React 16.5.0 with
facebook/react#13488

As discussed there, the alternative workaround is to simply use requestIdleCallback or requestAnimationFrame.

Once a better API is released (tracking facebook/react#13306) we can use that instead for deferred async updates.

Reviewed By: hansonw

Differential Revision: D9814299

fbshipit-source-id: 8848cf05cd11ffba65b6d87233e2f5205121179b
  • Loading branch information
pelmers committed Nov 15, 2018
1 parent d954e5a commit f9707e8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/nuclide-commons-ui/HighlightedCode.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* @format
*/

/* global requestAnimationFrame */

import * as React from 'react';
import ReactDOM from 'react-dom';
import {Button} from './Button';
import {HighlightedCode} from './HighlightedCode';

Expand All @@ -21,8 +22,8 @@ class HighlightedCodeExample extends React.Component<{}, {|count: number|}> {
};

_addOneMore = () => {
// $FlowIgnore
ReactDOM.unstable_deferredUpdates(() => {
// TODO(pelmers): Use react deferred update API when facebook/react/issues/13306 is ready
requestAnimationFrame(() => {
// TODO: (wbinnssmith) T30771435 this setState depends on current state
// and should use an updater function rather than an object
// eslint-disable-next-line react/no-access-state-in-setstate
Expand Down

0 comments on commit f9707e8

Please sign in to comment.