Unused variable "assigns" in live component's inner content

Hi guys! Did anyone encounter this unexpected warning in liveview?

So I have a live component:

<%= live_component @socket, ModalComponent,

id: "candidate-language-modal",

changeset: Candidate.changeset(@candidate),

open_modal?: @open_modal == "candidate-language-modal",

key: :candidate,

phx_submit: "direct_update_candidate:candidate-language-


current_user: @current_user,

candidate: @candidate do

new_assigns -> render "modal/language.html", new_assigns

end %>

But every time I compile it shows a warning that says: variable “assigns” is unused (if the variable is not meant to be used, prefix it with an underscore)

It seems this happened when we upgrade liveview from 0.14.8 to 0.15.3. Inside ModalComponent we have:

def render(%{open_modal?: true} = assigns) do



<%= render_block(@inner_block, assigns) %>




def render(assigns) do





Thanks in advance

1 Like

This clause doesn’t seem to use the assigns. Either do render(_) or render(_assigns) to get rid of the warning.

1 Like

~L does implicitly consume assigns.

I thought that would only happen if you actually use an assign by using @ syntax?

I never heard of that, but tbh given it implicitly uses assigns I would’ve imagined it to generate _ = assigns somewhere.