StarView.Dispatch (star_view v0.3.16)

Copy Markdown View Source

Marker-based Datastar dispatch for Phoenix controllers.

A controller is dispatchable when it uses use StarView, which injects __star_view_handler__/0.

What this plug does

  1. Reads Datastar signals from the request body.
  2. Starts the SSE response (StarView.start/1).
  3. Calls handle_event/3 on the target controller.
  4. Lets signal/3 patch browser signals immediately as your handler runs.

This means your handle_event/3 callbacks never need to call StarView.start/1 or manually send signal patches -- just use signal/3 and patch_element/3.