Skip to content

Read current time without marking event start time #17160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 21, 2019

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Oct 21, 2019

requestCurrentTime is only meant to be used for updates, because subsequent calls within the same event will receive the same time. Messing this up has bad consequences.

I renamed it to requestCurrentTimeForUpdate and created a new function that returns the current time without the batching heuristic, called getCurrentTime.

Swapping requestCurrentTime for getCurrentTime in the DevTools hook fixes the regression test added in #17159.

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.
@sizebot
Copy link

sizebot commented Oct 21, 2019

Size changes (stable)

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 15e4568

@sizebot
Copy link

sizebot commented Oct 21, 2019

Size changes (experimental)

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 15e4568

@gaearon
Copy link
Collaborator

gaearon commented Oct 21, 2019

Wow. Would never think it's DevTools causing this 😄

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint

`requestCurrentTime` is only meant to be used for updates, because
subsequent calls within the same event will receive the same time.
Messing this up has bad consequences.

I renamed it to `requestCurrentTimeForUpdate` and created a new
function that returns the current time without the batching heuristic,
called `getCurrentTime`.

Swapping `requestCurrentTime` for `getCurrentTime` in the DevTools
hook fixes the regression test added in the previous commit.
@acdlite acdlite merged commit 1022ee0 into facebook:master Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants