* fix bug - filter the exact entry to set state.edit_value in examples/todomvc
@@ -65,7 +65,14 @@ impl Component for App {
self.state.filter = filter;
}
Msg::ToggleEdit(idx) => {
- self.state.edit_value = self.state.entries[idx].description.clone();
+ let entry = self
+ .state
+ .entries
+ .iter()
+ .filter(|e| self.state.filter.fits(e))
+ .nth(idx)
+ .unwrap();
+ self.state.edit_value = entry.description.clone();
self.state.clear_all_edit();
self.state.toggle_edit(idx);
}
