Skip to content

Commit

Permalink
fix(leptos): fix reactivity warnings (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Jan 2, 2024
1 parent c15d891 commit 3e6e530
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/leptos-warning-reactiity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-tauri-app": "patch"
"create-tauri-app-js": "patch"
---

Fix warnings in `leptos` template related to reactivity.
5 changes: 3 additions & 2 deletions templates/template-leptos/src/app.rs.lte
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ pub fn App() -> impl IntoView {
let greet = move |ev: SubmitEvent| {
ev.prevent_default();
spawn_local(async move {
if name.get().is_empty() {
let name = name.get_untracked();
if name.is_empty() {
return;
}

let args = to_value(&GreetArgs { name: &name.get() }).unwrap();
let args = to_value(&GreetArgs { name: &name }).unwrap();
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
let new_msg = invoke("greet", args).await.as_string().unwrap();
set_greet_msg.set(new_msg);
Expand Down

0 comments on commit 3e6e530

Please sign in to comment.