Scoped Widgets

Events

Complex Interactive Auto

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 TodoWidget wraps its children in <StateScope TState="TodoListState" Name="widget">. Every list gets its own store, and every child that asks for TodoListState resolves the nearest one.
  • TodoInput publishes TodoAdded with the default Route.Bubble: the widget scope, then up to the root, where ActivityLog listens.
  • Clear done publishes ClearCompletedRequested with Route.Local. Only that widget's TodoItems hears it, and the log's counter stays at 0.
  • Reset all lists publishes ResetAllRequested with Route.Global, which broadcasts from the root into every scope.
  • TodoStats uses 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.
Groceries

Nothing here yet.

Work

Nothing here yet.

Weekend

Nothing here yet.

Activity log (root subscriber)

Clear-done events seen: 0
Add or tick items in any list…
An unhandled error has occurred. Reload πŸ—™