tc39 / proposal-signals

A proposal to add signals to JavaScript.
MIT License
3.42k stars 59 forks source link

Polyfill bug: throwing during watched/unwatched interrupts algorithm #75

Open littledan opened 7 months ago

littledan commented 7 months ago

We have to make sure that the full graph coloring algorithm runs to completion before triggering any watched/unwatched callbacks. As things stand today, I think an exception thrown at the wrong time will leave the signal graph in a bad state. The algorithm descriptions in the readme should also clarify that this bad state doesn’t happen.

backbone87 commented 7 months ago

maybe errors during watched/unwatched should be handled like an unhandled promise rejection and reported in its own stack? rxjs has a global reportError that by default forwards to globalThis.reportError or console.error afair.