Update continue_edit() to reload Translation

Reloading is necessary to detect changes in the changeset. Otherwise
simple changes like changing the value of translation.public wouldn't
get noticed and not being saved to db.
This commit is contained in:
Thelonius Kort
2023-03-03 21:57:09 +01:00
parent b20bbb232c
commit 5319785855

View File

@ -187,6 +187,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
defp continue_edit(socket, :edit, %{"continue_edit" => "true"}) do defp continue_edit(socket, :edit, %{"continue_edit" => "true"}) do
socket socket
|> assign(:translation, Translations.get_translation!(socket.assigns.translation.id))
end end
defp continue_edit(socket, :new, %{"continue_edit" => "true"} = params) do defp continue_edit(socket, :new, %{"continue_edit" => "true"} = params) do
socket |> push_patch(to: ~p(/translations/#{params["id"]}/edit)) socket |> push_patch(to: ~p(/translations/#{params["id"]}/edit))