civiccc / civiccc/react-waypoint

Break up onNextTick() queue consumption into ~50ms chunks

Open
#193 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
4k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

In #188 I merged an attempt to improve startup time of rendering many waypoints on the same page by clustering all of the timeouts from the initial render into one. This has a side-effect of causing all of the waypoints to execute in the same call stack, which might peg the main thread longer than we like.

In order to keep the browser responsive, I think it would make sense to, when consuming the `timeoutQueue` to check and see if it has been 50ms or more (preferring `performance.now` if it is available) and if it has, pause the queue consumption and call a new `setTimeout` to resume it.

I'll be traveling for a while so I won't be able to dig into this for a while, but I'd like to hear other people's thoughts and if someone else wants to pick this up that would be wonderful!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.