- From: Justin Fagnani <notifications@github.com>
- Date: Sun, 18 Aug 2024 13:14:51 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/1069/2295377324@github.com>
@NullVoxPopuli if there's any appetite for this idea, we can go into a lot of detail about how signals integration would work. At a high level for now, I think that there are a few good spots for integration: 1. At the DOM Part level: Individual parts accept signals and update when the signals change. To feed in a computation that uses signals, you'd first wrap it in a computed to tell the DOM Part to watch it. 2. By wrapping a template expression + `.render()` call in an effect so that any signal access is tracked and updates cause a re-render. By doing the effect outside/around of the `.render()` call, it lets the effect setup use the scheduling it needs - microtask, framework scheduler, etc. 3. An integration of (1) + (2) where a DOM Part holding a signal defers its updates to an external scheduler, so that they can use the same scheduler as in (2). This could let pin-point updates happen without a full template re-render, or be batched with a full re-render if one is already scheduled. This kind of deferring scheduling would also work with a component system that controls the effect and scheduler. An API to pass in the external scheduler could take the form of extra options to `.render()`, though the shape would have to be figured out - is the option a schedule callback, or a Watcher, or is there an event? We do something similar to this with lit-html where a RenderOptions (maybe it would be better named a RenderContext though) object is passed down the tree of templates as they are rendered. Re the second syntax you show, I'm trying to propose something here that doesn't require any changes to JavaScript, but could use them if they ever happen in the future. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1069#issuecomment-2295377324 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1069/2295377324@github.com>
Received on Sunday, 18 August 2024 20:14:55 UTC