Socket.assigns are empty in handle_info callback

I am trying to add a item in the list like this.
In context module.

def create_message(%Message{} = message, attrs) do 
  |> Message.changeset(attrs)
  |> Repo.insert()
  |> broadcast(:new_message)

@topic __MODULE__

def broadcast({:ok, message}, event) do
  Phoenix.PubSub.broadcast(MyApp.PubSub, @topic, {event, message})
  {:ok, message}

in liveview module

def mount(_params, _session, socket) do
  if connected?(socket), do: Messages.subscribe()
  messages = Messages.get_messages()
  socket = assign(socket, :messages, messages)
  {:ok, socket, temporary_assigns: [messages: []]}

def handle_info({:new_message, new_message}, socket) do
  socket = update(socket, :messages, fn messages -> [new_message | messages] end)
  {:noreply, socket}

So When I create a new message, handle_info receives a new message but
socket.assigns.messages is empty list.

I think I did temporary_assigns for messages
If i remove temporary_assigns, it shows whole messages and prepending new message.

I don’t want to keep whole messages in memory that’s why I use temporary_assigns
What am i doing wrong?

You aren’t doing anything wrong, With temporary assigns it should update the DOM and then clear the assigns, When you update the messages, it should update/prepend/append depending on what you have set for phx-update

How does your html markup look like? Do you see all the messages in your page rendered?

Yes I see all messages when the page rendered first time.
It looks like this

 <div id="messages" phx-update="prepend">
   <%= for message <- @messages do %>
      <tr id={"#{}"}>

What is the issue? If it is for the assigns being empty in the handle_info, that is normal if you have it with temporary_assigns