Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
return;
}

const { _id, ...data } = newRecord;
this.collection.direct.upsert({ _id } as Mongo.Selector<T>, { $set: data } as Mongo.Modifier<T>);
const { _id } = newRecord;
this.collection.direct.upsert({ _id } as Mongo.Selector<T>, newRecord);
this.emit('changed', newRecord as any); // TODO: investigate why this is needed

if (hasUpdatedAt(newRecord) && newRecord._updatedAt > this.updatedAt) {
Expand Down Expand Up @@ -232,8 +232,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
if (action === 'removed') {
this.collection.remove(newRecord._id);
} else {
const { _id, ...data } = newRecord;
this.collection.direct.upsert({ _id } as Mongo.Selector<T>, { $set: data } as Mongo.Modifier<T>);
const { _id } = newRecord;
this.collection.direct.upsert({ _id } as Mongo.Selector<T>, newRecord);
}
this.save();
});
Expand Down Expand Up @@ -276,8 +276,8 @@ export class CachedCollection<T extends object> extends Emitter<{ changed: T; re
const actionTime = newRecord._updatedAt;
changes.push({
action: () => {
const { _id, ...data } = newRecord;
this.collection.direct.upsert({ _id } as Mongo.Selector<T>, { $set: data } as Mongo.Modifier<T>);
const { _id } = newRecord;
this.collection.direct.upsert({ _id } as Mongo.Selector<T>, newRecord);
if (actionTime > this.updatedAt) {
this.updatedAt = actionTime;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function upsertMessage(
);
}

return direct.upsert({ _id }, { $set: messageToUpsert });
return direct.upsert({ _id }, msg);
}

export function upsertMessageBulk(
Expand Down