Remove assigns in LiveView

Hi!

Is there an opposite of assign(socket ...) ?

i’m looking to remove an assigns from the socket, but the only solution i’m seeing is setting the assigns value to nil

I tried this, but it didn’t work for me:

1 Like

Hello,
assigns is a Map, so it should work

%{
  socket 
  | assigns: Map.delete(socket.assigns, :key), 
    changed: Map.put_new(socket.changed, :key, true)
}
4 Likes

Ah, I missed the changed part. Thanks!!