Skip to content

Commit 47b5ad0

Browse files
authored
fix: double click bug in todo app (#3978)
* bug fix: in update, ToggleEdit(idx) holds an index to the unfiltered list of tasks - not the filtered list displayed to the user.
1 parent 1ef5f54 commit 47b5ad0

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

examples/todomvc/src/main.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,7 @@ impl Component for App {
6262
self.state.filter = filter;
6363
}
6464
Msg::ToggleEdit(idx) => {
65-
let entry = self
66-
.state
67-
.entries
68-
.iter()
69-
.filter(|e| self.state.filter.fits(e))
70-
.nth(idx)
71-
.unwrap();
65+
let entry = self.state.entries.get(idx).unwrap();
7266
self.state.edit_value.clone_from(&entry.description);
7367
self.state.clear_all_edit();
7468
self.state.toggle_edit(idx);

0 commit comments

Comments
 (0)