revery icon indicating copy to clipboard operation
revery copied to clipboard

Problem with State update with interval

Open czystyl opened this issue 5 years ago • 1 comments

ezgif com-video-to-gif

  • Operating System: macOS 10.15
  • Revery Version: 0.29
  • OCaml version: version 4.06.1
  • Link to github repo: https://github.com/czystyl/revery-tick-issues

  • Actual Result: The repro contains a short video as well.

I used setInterval to update the component state each 50 ms. The counter from the hook state was not updating every 50ms but much slower than expected. However, when we start moving the mouse over the app, or we use press/hold key from the keyboard, then the counter is incrementing much faster than before.

  • Search terms used: timer, set interval, counter

czystyl avatar Jan 24 '20 06:01 czystyl

If you set canIdle to be false then this problem disappears.

Is it worth doing let evt = Sdl2.Event.waitTimeout(250); in the main loop just to save the if statement checking if it should shift into the active state or not?

ericluap avatar Apr 25 '20 06:04 ericluap