fix: batch load fills multiple identical objects
in case of an announce and a view, we get the attachments only once otherwise and frontend may overwrite cache with the empty one. this is wasteful because we clone everytime tho, TODO!
This commit is contained in:
parent
a901ae7656
commit
6f5b494a25
1 changed files with 4 additions and 2 deletions
|
@ -36,8 +36,10 @@ impl BatchFillable for Vec<RichActivity> {
|
|||
}
|
||||
for element in self.iter_mut() {
|
||||
if let Some(ref object) = element.object {
|
||||
if let Some(v) = map.remove(&object.internal) {
|
||||
element.accept(v, tx).await?;
|
||||
if let Some(v) = map.get(&object.internal) {
|
||||
// TODO wasteful because we clone every time, but we cant do remove otherwise multiple
|
||||
// identical objects wont get filled (for example, a post boosted twice)
|
||||
element.accept(v.clone(), tx).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue