Several instances of the same widget, each with its own state and its own event scope, plus a page-level log that hears what bubbles out of them.
How it works
Try it: add items to different lists, tick some, then use Clear done in one list and Reset all lists.
- Each
TodoWidgetwraps its children in<StateScope TState="TodoListState" Name="widget">. Every list gets its own store, and every child that asks forTodoListStateresolves the nearest one. TodoInputpublishesTodoAddedwith the defaultRoute.Bubble: the widget scope, then up to the root, whereActivityLoglistens.- Clear done publishes
ClearCompletedRequestedwithRoute.Local. Only that widget'sTodoItemshears it, and the log's counter stays at 0. - Reset all lists publishes
ResetAllRequestedwithRoute.Global, which broadcasts from the root into every scope. TodoStatsuses a tuple selector(Done, Total). Its render counter only moves when those numbers change.- Removing a widget disposes its scope and store. Its subscriptions disappear with it.