Re: [WICG/webcomponents] Idea: A tree-aware task scheduler (Issue #1055)

> > @rniwa exactly
> 
> The timing of batching seems like a key question here then.

Yeah, that's going to be the bulk of figuring out a proposal I think.

> It could be once per a microtask, a task, or an animation frame.

Once per microtask is an intriguing option. This would make waiting for a subtree to render potentially not require another API, since you could just enqueue a microtask for that. Of course, you can already wait for a rAF, but that sounds like it has occasionally caused problems for some people.

Another question is whether or not the update queue could be flushed synchronously. We've had developers want to use `.offsetHeight` and friends, but they don't work correctly with pending async updates. ResizeObserver might have obsoleted these cases. Still, it would be cool if we could get bother batching and make synchronous measurement APIs flush (or maybe throw if there are pending tasks in the subtree!).

Yet another question is whether we need priorities, and if so should they be compatible with the Prioritized Task Scheduling proposal: https://wicg.github.io/scheduling-apis/ In my past experience it's been easy to do lower priority scheduling in userland, but it might be good to integrate lower-priority tasks if we have some kind of flushing or pending state query feature.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1055#issuecomment-2078286416
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1055/2078286416@github.com>

Received on Thursday, 25 April 2024 22:40:04 UTC