srcrip / live_toast

A beautiful drop-in replacement for the Phoenix Flash system.
https://toast.src.rip
MIT License
129 stars 9 forks source link

`put_toast` do not work with `push_navigate` #11

Open luislhsc opened 2 weeks ago

luislhsc commented 2 weeks ago

Hey, thank you for all your effort on this lib! It is awesome, very customizable and looks great.

On thing I noticed, is that it only works on my live components/view if I use push_patch

case create_thing(socket, params) do
      {:ok, thing} ->
        socket
        |> put_toast(:success, "Thing was created!")
        |> push_patch(to: ~p"/app/thing/#{thing.id}")
        |> noreply()

      {:error, changeset} ->
        socket
        |> assign(:form, to_form(changeset))
        |> noreply()
    end

If I change it to be push_navigate instead of patch:

        socket
        |> put_toast(:success, "Thing was created!")
        |> push_navigate(to: ~p"/app/thing/#{thing.id}")
        |> noreply()

The toast does not work. Is it a bug or is there a limitation to make it work with push_navigate? Just a note, the put_flash from Phoenix/Liveview works on push_patch/push_navigate/redirect.

srcrip commented 3 days ago

This seems to be the same thing noticed in https://github.com/srcrip/live_toast/issues/9... I'm going to take a look at it today. If you have a minimal repro it would help a lot though.

srcrip commented 6 hours ago

ok I have a plan for how to implement this. I should have it ready in a few days.