# `Mutare.Phoenix.LiveView.Reply`
[🔗](https://github.com/foxbenjaminfox/mutare_phoenix_live_view/blob/v0.2.1/lib/mutare/phoenix/live_view/reply.ex#L1)

`:lv_reply` — drops the optional trailing element of a LiveView callback's return tuple,
reshaping it into a different but still valid return. Applies in modules that implement
`@behaviour Phoenix.LiveView` **or** `@behaviour Phoenix.LiveComponent`:

    handle_event/3   {:reply, payload, socket}  ->  {:noreply, socket}
    handle_call/3    {:reply, reply, socket}    ->  {:noreply, socket}
    mount/3          {:ok, socket, opts}         ->  {:ok, socket}

A survivor means no test checks the dropped element — the JS-hook reply payload, or the
`mount` `temporary_assigns:` / `layout:` option. A `Phoenix.LiveComponent`'s `handle_event/3`
returns the same `{:reply, payload, socket}` shape, so the same mutation tests its reply
payload; the `{:ok, socket, opts}` (mount) reshape never matches a component return.

Matched by tuple shape, independent of which callback contains it. The 2-tuples
`{:noreply, socket}` / `{:ok, socket}` have nothing to drop and are left alone. Silence a
site with `# mutare:ignore[lv_reply]`.

Under `--no-expand-uses` the `@behaviour` that `use Phoenix.LiveView` / `use
Phoenix.LiveComponent` injects is not expanded, so `:lv_reply` produces no mutations;
a direct `@behaviour` still works.

# `return_replacements`

```elixir
@spec return_replacements(Macro.t(), Mutare.Mutator.Structural.context()) :: [
  Macro.t()
]
```

Return replacements for the LiveView return tuple `tail`, but only inside a module that
implements one of `[Phoenix.LiveView, Phoenix.LiveComponent]` (read from `context.behaviours`).
The behaviour-aware variant of `c:Mutare.Mutator.Structural.return_replacements/1`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
