diff --git a/fixtures/unstable-async/time-slicing/src/index.js b/fixtures/unstable-async/time-slicing/src/index.js index 2c903e0a39..e6212c1020 100644 --- a/fixtures/unstable-async/time-slicing/src/index.js +++ b/fixtures/unstable-async/time-slicing/src/index.js @@ -1,4 +1,4 @@ -import React, {Component, PureComponent, unstable_AsyncMode} from 'react'; +import React, {PureComponent, unstable_AsyncMode} from 'react'; import {flushSync, render, unstable_deferredUpdates} from 'react-dom'; import _ from 'lodash'; import Charts from './Charts'; @@ -64,9 +64,12 @@ class App extends PureComponent { } this._ignoreClick = true; - unstable_deferredUpdates(() => { - this.setState({showDemo: true}, () => { - this._ignoreClick = false; + // TODO: needing setTimeout here seems like a React bug. + setTimeout(() => { + unstable_deferredUpdates(() => { + this.setState({showDemo: true}, () => { + this._ignoreClick = false; + }); }); }); }; @@ -79,15 +82,13 @@ class App extends PureComponent { } }, 1000); - renderOption(strategy, label, enabled) { + renderOption(strategy, label) { const {strategy: currentStrategy} = this.state; return (