tc39 / proposal-signals

A proposal to add signals to JavaScript.
MIT License
2.95k stars 54 forks source link

Fix `this` in normal function `notify` #160

Closed yeomanse closed 1 month ago

yeomanse commented 1 month ago

Before notify was called from the ReactiveNode context and was calling with the node as this instead of the expected watcher. Instead, set consumerMarkedDirty to a function that wraps notify with a proper call with this.

Also add unit tests for our expected behavior here including closure for an arrow function.

This is a follow up after https://github.com/proposal-signals/proposal-signals/pull/146 got closed We are moving forward with different semantics than that one but the bug still needed to be fixed.