feat: Add signal-based binding support to ObserverMap and TemplateElement#7306
Open
feat: Add signal-based binding support to ObserverMap and TemplateElement#7306
Conversation
d9d0666 to
863f330
Compare
863f330 to
1d10b3b
Compare
janechu
reviewed
Mar 9, 2026
Collaborator
janechu
left a comment
There was a problem hiding this comment.
Let's check on the performance on this change.
change/@microsoft-fast-element-cbc19b38-8c85-4701-b1a6-8236b4644f47.json
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
📖 Description
Replace the
Observable.notify-based change propagation infast-html's Observer Map and template binding system with Signal-based pub/sub from@microsoft/fast-element/binding/signal.js.The Observer Map feature previously relied on
Observable.notify(target, property)to inform bindings of deep property changes in proxied objects. This approach coupled change detection to the Observable property accessor system, which wasn't designed for the proxy-mediated, deeply-nested data patterns used in Declarative Shadow DOM templates.This PR introduces a Signal-based notification model that follows the patterns established by the
SignalBindingmodule infast-element:fh:<id>) via aWeakMapObserverMapObservercombines Signal subscriptions (for deep proxy changes) with standardObservable.bindingexpression watching (for direct property access like array items)ObserverMapBindingextends theBindingbase class and supports multi-signal subscriptions for nested repeat contextssettraps andObserverMap.defineChangedhandlers now broadcast viaSignal.sendinstead ofObservable.notifyThe public API (
TemplateElement.options,ObserverMap, template syntax) is unchanged — developers use observer maps and observables in DSD exactly as before.👩💻 Reviewer Notes
ObserverMapObserveris the central new abstraction — it's worth reviewing its dual-subscription model (Signal + Observable expression watcher) to ensure correctness across all binding contexts.notifyObservablesnow walks up the target chain recursively so nested proxies ultimately signal the owning element.📑 Test Plan
All existing Playwright fixture tests pass across Chromium, Firefox, and WebKit (336 tests). No new tests were added — the existing observer-map, deep-merge, and other fixture tests validate the behavioral equivalence of the Signal-based approach.
✅ Checklist
General
$ npm run change