Skip to content

Commit

Permalink
Fix view action flash
Browse files Browse the repository at this point in the history
  • Loading branch information
tfwright committed Sep 28, 2024
1 parent 9cfc5bd commit 92f5772
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/live_admin/components/container.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule LiveAdmin.Components.Container do
socket =
assign(socket, loading: !connected?(socket), jobs: [])

if connected?(socket), do: Process.send_after(self(), :clear_flash, 2000)
if connected?(socket), do: Process.send_after(self(), :clear_flash, 1000)

{:ok, socket}
end
Expand All @@ -31,6 +31,11 @@ defmodule LiveAdmin.Components.Container do
{:noreply, clear_flash(socket)}
end

def handle_info(arg, socket) do
IO.inspect(arg)
{:noreply, socket}
end

@impl true
def handle_params(
params = %{"record_id" => id},
Expand Down
4 changes: 2 additions & 2 deletions lib/live_admin/components/resource/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,12 @@ defmodule LiveAdmin.Components.Container.Index do
socket =
socket
|> put_flash(
:success,
:info,
trans("Action running on %{count} records: %{action}",
inter: [count: Enum.count(ids), action: action]
)
)
|> push_patch(
|> push_redirect(
to: route_with_params(socket.assigns, params: list_link_params(socket.assigns))
)

Expand Down

0 comments on commit 92f5772

Please sign in to comment.