Skip to content

Commit e27a4bb

Browse files
committed
Fix view action flash
1 parent 9cfc5bd commit e27a4bb

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/live_admin/components/container.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defmodule LiveAdmin.Components.Container do
2121
socket =
2222
assign(socket, loading: !connected?(socket), jobs: [])
2323

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

2626
{:ok, socket}
2727
end
@@ -31,6 +31,10 @@ defmodule LiveAdmin.Components.Container do
3131
{:noreply, clear_flash(socket)}
3232
end
3333

34+
def handle_info(_, socket) do
35+
{:noreply, socket}
36+
end
37+
3438
@impl true
3539
def handle_params(
3640
params = %{"record_id" => id},

lib/live_admin/components/resource/index.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,12 @@ defmodule LiveAdmin.Components.Container.Index do
456456
socket =
457457
socket
458458
|> put_flash(
459-
:success,
459+
:info,
460460
trans("Action running on %{count} records: %{action}",
461461
inter: [count: Enum.count(ids), action: action]
462462
)
463463
)
464-
|> push_patch(
464+
|> push_redirect(
465465
to: route_with_params(socket.assigns, params: list_link_params(socket.assigns))
466466
)
467467

test/live_admin/components/container_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule LiveAdmin.Components.ContainerTest do
5151
|> element("#list")
5252
|> render_hook("action", %{name: "user_action", ids: []})
5353

54-
assert_patch(view)
54+
assert_redirect(view)
5555
end
5656

5757
test "runs task", %{view: view} do

0 commit comments

Comments
 (0)