Mutare.Phoenix.LiveView (mutare_phoenix_live_view v0.1.0)

Copy Markdown View Source

Mutare mutators for the Phoenix LiveView surface: socket navigation, callback reply tuples, stream operations, pushed client events, child-component updates, and lifecycle-hook attachment.

This package depends on mutare_phoenix (and through it mutare_plug), so the controller-level and conn-level families are on your code path too; compose the three presets for a full-stack app (see "Usage").

Families

Auth-hook :cont/:halt decisions (in on_mount and inside hook functions) are covered by Mutare's built-in :convention family (on by default), not by this package — :lv_hook removes the attachment call itself, a different axis.

Usage

Splice all/0 into :mutators in your .mutare.exs alongside the :builtins group token (which keeps Mutare's own families on, including :convention):

# .mutare.exs — a LiveView app
[mutators: [:builtins] ++ Mutare.Phoenix.LiveView.all()]

A full-stack app that also wants the conn-level and controller-level families composes all four groups, and lists Mutare.Phoenix under :extensions for its defensive Phoenix macro routing:

# .mutare.exs — a full-stack Phoenix + LiveView app
[
  mutators:
    [:builtins] ++ Mutare.Plug.all() ++ Mutare.Phoenix.all() ++
      Mutare.Phoenix.LiveView.all(),
  extensions: [Mutare.Phoenix]
]

all/0 returns only the six LiveView families — it does not include the base mutare_plug / mutare_phoenix families, so compose Mutare.Plug.all/0 and Mutare.Phoenix.all/0 explicitly as shown above.

To drop a family that is too noisy for your suite (e.g. :lv_stream, :lv_event, or :lv_send_update in an app that never asserts stream contents, pushed events, or component updates), leave it out of the list you splice in, or silence individual sites with # mutare:ignore[lv_stream] — the families that produce several kinds declare variant labels, so a qualified # mutare:ignore[lv_stream:at] suppresses just one kind (see each family's moduledoc for its labels).

The package matches module names (Phoenix.LiveView), so it depends on neither phoenix_live_view nor phoenix — resolution happens in your project, where they are present.

Summary

Functions

This package's six LiveView mutator families — Navigation, Reply, Stream, Event, SendUpdate, Hook.

Functions

all()

@spec all() :: [module(), ...]

This package's six LiveView mutator families — Navigation, Reply, Stream, Event, SendUpdate, Hook.

It does not include the base mutare_plug / mutare_phoenix families; compose those explicitly with Mutare.Plug.all/0 and Mutare.Phoenix.all/0 when you want the full Plug + Phoenix + LiveView surface (see the moduledoc's "Usage").

iex> Mutare.Phoenix.LiveView.all()
[Mutare.Phoenix.LiveView.Navigation, Mutare.Phoenix.LiveView.Reply,
 Mutare.Phoenix.LiveView.Stream, Mutare.Phoenix.LiveView.Event,
 Mutare.Phoenix.LiveView.SendUpdate, Mutare.Phoenix.LiveView.Hook]