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

Yes, Signals integration is the thing that pushed me to file this issue.

Trying to solve the ordering problem on the Signals side is very difficult, because we would need to introduce an idea of a tree-structured ownership of watchers, and either a built-in scheduler that notifies the watchers in order, or allows them to schedule effects in order. Then you would need that to be mutable to reflect DOM updates, and maintain possibly some ownership or current watcher context across async boundaries with AsyncContext. It's quite a lot to add to Signals and I think it wouldn't get done.

But on the DOM side of things we already have a tree that always accurately reflects the DOM - the DOM tree itself. We wouldn't need to possibly implicitly build a tree based on async context like might be necessary with signals. And there are many non-Signals use cases that a scheduling API could help with, so a solution would be more general. Being both easier and more general suggests this is the right place for such a thing.

If we had this, then signals integration would be pretty straight forward.

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

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

Received on Thursday, 25 April 2024 16:00:55 UTC