diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs index f4fd3b1..54a9c5d 100644 --- a/dyesub-tool/src/main.rs +++ b/dyesub-tool/src/main.rs @@ -104,8 +104,7 @@ fn KeyboardFromFile( let file_input = create_node_ref::(cx); let (file, set_file) = create_signal(cx, Option::::None); let (result_message, set_result_message) = create_signal(cx, Option::::None); - let on_submit = move |e: SubmitEvent| { - e.prevent_default(); + let on_submit = move || { spawn_local(async move { match read_kle_from_file(&file).await { Ok(keyboard) => { @@ -119,34 +118,35 @@ fn KeyboardFromFile( })); set_keyboard(Some(keyboard)); } - Err(err) => set_result_message(Some(ResultMessageData { - message: view! { cx, - { - err.to_string() + Err(err) => { + set_result_message(Some(ResultMessageData { + message: view! { cx, + { + err.to_string() + } } - } - .into_view(cx), - title: >::into(err).to_string(), - colorway: Colorway::Bad, - })), + .into_view(cx), + title: >::into(err).to_string(), + colorway: Colorway::Bad, + })); + file_input().unwrap().set_value(""); + }, } }); }; view! { cx,

"Load KLE JSON from file"

-
+ - - -
} }