From 68aa840764fe7d50399f816d35731355ed6d635c Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 21 Oct 2019 11:34:19 -0700 Subject: [PATCH] Failing test: DevTools hook freezes timeline The DevTools hook calls `requestCurrentTime` after the commit phase has ended, which has the accidnental consequence of freezing the start time for subsequent updates. If enough time goes by, the next update will instantly expire. I'll push a fix in the next commit. --- ...ofilerDevToolsIntegration-test.internal.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js index b3efa665d576e..37095b871cdd0 100644 --- a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js +++ b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js @@ -177,4 +177,26 @@ describe('ReactProfiler DevTools integration', () => { {name: 'some event', timestamp: eventTime}, ]); }); + + it('regression test: #', () => { + function Text({text}) { + Scheduler.unstable_yieldValue(text); + return text; + } + + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); + + root.update(); + expect(Scheduler).toFlushAndYield(['A']); + expect(root).toMatchRenderedOutput('A'); + + Scheduler.unstable_advanceTime(10000); + root.update(); + + // Update B should not have expired + expect(Scheduler).toFlushExpired([]); + + expect(Scheduler).toFlushAndYield(['B']); + expect(root).toMatchRenderedOutput('B'); + }); });