Rendering 404s through LiveView

I display a flash message for situations like this and redirect to an index view, e.g. in your {:error, reason} case:

      {:ok, socket
        |> put_flash(:error, msg)
        |> push_redirect(to: Routes.live_path(socket, ReactionWeb.AnalysisProject.Index))
      }

I haven’t figured out how to clear flash messages in my app template without an http round trip, but I’m in a no-mans land between 0.9.0 and 0.10.0 and that was cleared up with the live templates.

This approach may or may not be useful for you, but it works for my use case.

1 Like