example: fix so we remove by ID, not by id-as-index

This commit is contained in:
Greg Johnston 2024-09-14 18:33:36 -04:00
parent f3f685c923
commit 5ab865e89d

View file

@ -154,17 +154,14 @@ fn TodoRow(
<button on:click=move |_| { <button on:click=move |_| {
let id = todo.id().get(); let id = todo.id().get();
store store.todos().write().retain(|todo| todo.id != id);
.todos()
.update(|todos| {
todos.remove(id);
});
}>"X"</button> }>"X"</button>
<input <input
type="date" type="date"
prop:value=move || { prop:value=move || {
todo.status().scheduled_for_date().map(|n| n.get().to_string()) todo.status().scheduled_for_date().map(|n| n.get().to_string())
} }
class:hidden=move || !todo.status().scheduled_for() class:hidden=move || !todo.status().scheduled_for()
on:change:target=move |ev| { on:change:target=move |ev| {
if let Some(date) = todo.status().scheduled_for_date() { if let Some(date) = todo.status().scheduled_for_date() {