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

Commit f9707e8

Browse files
committed
Replace deferredUpdates usages
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
1 parent d954e5a commit f9707e8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/nuclide-commons-ui/HighlightedCode.example.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
* @format
1111
*/
1212

13+
/* global requestAnimationFrame */
14+
1315
import * as React from 'react';
14-
import ReactDOM from 'react-dom';
1516
import {Button} from './Button';
1617
import {HighlightedCode} from './HighlightedCode';
1718

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

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

0 commit comments

Comments
 (0)