diff --git a/lib/microwaveprop_web/live/submit_live.ex b/lib/microwaveprop_web/live/submit_live.ex index 3ae3c778..df144e55 100644 --- a/lib/microwaveprop_web/live/submit_live.ex +++ b/lib/microwaveprop_web/live/submit_live.ex @@ -17,25 +17,27 @@ defmodule MicrowavepropWeb.SubmitLive do def mount(_params, _session, socket) do socket = allow_upload(socket, :csv, accept: ~w(.csv), max_entries: 1, max_file_size: 10_000_000) + changeset = Radio.change_contact(%Contact{}) + + socket = + assign(socket, + page_title: "Submit Contact", + form: to_form(changeset), + band_options: @band_options, + mode_options: @mode_options, + submitted_at: nil, + active_tab: :single, + csv_preview: nil, + csv_result: nil, + csv_email: "" + ) + case LiveStash.recover_state(socket) do {:recovered, socket} -> {:ok, socket} _ -> - changeset = Radio.change_contact(%Contact{}) - - {:ok, - assign(socket, - page_title: "Submit Contact", - form: to_form(changeset), - band_options: @band_options, - mode_options: @mode_options, - submitted_at: nil, - active_tab: :single, - csv_preview: nil, - csv_result: nil, - csv_email: "" - )} + {:ok, socket} end end