Skip to content

Commit

Permalink
Reindex mapped values from the ObservableVec
Browse files Browse the repository at this point in the history
Signed-off-by: [email protected]
  • Loading branch information
gferon committed Nov 28, 2024
1 parent 6d6f8e4 commit 9bfaf81
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/matrix-sdk-base/src/store/observable_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ where
L: Hash + Eq + ?Sized,
{
let position = self.mapping.remove(key)?;
// reindex every mapped entry that is after the position we're looking to remove
for mposition in self.mapping.values_mut().filter(|mposition| **mposition > position) {
*mposition = mposition.saturating_sub(1);
}
Some(self.values.remove(position))
}
}
Expand Down

0 comments on commit 9bfaf81

Please sign in to comment.