Auto-closing drawer LiveComponent after file upload

My expectation is that once the def handle_event(“upload”, %{“broker” => broker, “timezone” => timezone}, socket) successfully completes, it calls the hide() function to hide the panel and its backdrop.

I have tried the following at the end of my upload event but was not successful:

socket = assign(socket, is_uploader_visible?, false)
hide(socket.assigns.id)
{:noreply, socket}

If you look at the close button it is doing exactly what I expect

<button
   type="button"
   class="relative rounded bg-green-600 text-green-200 hover:text-white focus:ring-2 focus:ring-white focus:outline-none p-0 flex items-center justify-center h-7 w-7"
   phx-click={JS.push("hide-uploader", target: @myself) |> hide(@id)}
>
  <span class="absolute -inset-2.5"></span>
  <span class="sr-only">{gettext("Close panel")}</span>
  <.icon name="hero-x-mark" class="size-6" />
</button>