Skip to content

setInterval slows down with tab/window inactive #2

@hy2850

Description

@hy2850

10 seconds have passed in real time, but only 5~6 seconds changed on the Timer.

Possible reasons behind the issue

  • JS threading issue? (single thread)
  • setInterval guarantees that the time gap between callback execution is at least 'delay' argument, not that callback executes exactly after the 'delay' Ref
    → other processes may meddle in before callback executes, making it longer than 'delay' for callback to run = our Timer doesn't tick per second
  • Or maybe performance issue related with React useEffect hook Link

related question
https://stackoverflow.com/questions/23506103/setinterval-slows-down-with-tab-window-inactive

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions