Skip to content

_untracked writes on Store fields notify some store fields #4488

@gbj

Description

@gbj
  1. Update the stores example to do an untracked write when adding a todo:
diff --git a/examples/stores/src/lib.rs b/examples/stores/src/lib.rs
index b13aae37e..eb599c643 100644
--- a/examples/stores/src/lib.rs
+++ b/examples/stores/src/lib.rs
@@ -98,7 +98,7 @@ pub fn App() -> impl IntoView {
         <hr/>
         <form on:submit=move |ev| {
             ev.prevent_default();
-            store.todos().write().push(Todo::new(input_ref.get().unwrap().value()));
+            store.todos().write_untracked().push(Todo::new(input_ref.get().unwrap().value()));
         }>
             <label>"Add a Todo" <input type="text" node_ref=input_ref/></label>
             <input type="submit"/>
  1. Add a new todo
  2. The list in the DOM updates, but the stringified version in the <pre> tag does not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions