File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
crates/matrix-sdk/src/event_cache Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ impl EventCache {
241241
242242 let event_ids: BTreeSet < _ > =
243243 events. iter ( ) . cloned ( ) . map ( |( event_id, _, _) | event_id) . collect ( ) ;
244-
244+ let mut new_events = Vec :: with_capacity ( events . len ( ) ) ;
245245
246246 for ( event_id, decrypted, actions) in events {
247247 // The event isn't in the cache, nothing to replace. Realistically this can't
@@ -256,10 +256,15 @@ impl EventCache {
256256
257257 // TODO: `replace_event_at()` propagates changes to the store for every event,
258258 // we should probably have a bulk version of this?
259- state. replace_event_at ( location, target_event) . await ?
259+ state. replace_event_at ( location, target_event. clone ( ) ) . await ?;
260+ new_events. push ( target_event) ;
260261 }
261262 }
262263
264+ // TODO: Is this useful? Do I need to call this once per event as well because
265+ // replace event at works on a single event?
266+ state. post_process_new_events ( new_events, false ) . await ?;
267+
263268 // We replaced a bunch of events, reactive updates for those replacements have
264269 // been queued up. We need to send them out to our subscribers now.
265270 let diffs = state. room_linked_chunk_mut ( ) . updates_as_vector_diffs ( ) ;
Original file line number Diff line number Diff line change @@ -1439,7 +1439,7 @@ mod private {
14391439 /// linked chunk.
14401440 ///
14411441 /// Flushes updates to disk first.
1442- async fn post_process_new_events (
1442+ pub ( crate ) async fn post_process_new_events (
14431443 & mut self ,
14441444 events : Vec < Event > ,
14451445 is_sync : bool ,
You can’t perform that action at this time.
0 commit comments