From ae63110335dd1bf83188940d0209a8d58dd7cc9b Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 2 Aug 2018 00:02:24 +0100 Subject: [PATCH] Fix time slicing fixture (#13305) * Fix time slicing fixture * Remove unused option --- .../unstable-async/time-slicing/src/index.js | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) 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 (