prevent re-setting unchanged objects
This commit is contained in:
Vendored
+4
@@ -938,9 +938,13 @@
|
|||||||
const existingObject = this.objects.value.get(messageObject.id);
|
const existingObject = this.objects.value.get(messageObject.id);
|
||||||
if (existingObject) {
|
if (existingObject) {
|
||||||
existingObject.title = messageObject.title;
|
existingObject.title = messageObject.title;
|
||||||
|
let didChangeObject = false;
|
||||||
Object.values(messageObject.contentVersions).forEach((content) => {
|
Object.values(messageObject.contentVersions).forEach((content) => {
|
||||||
|
if (existingObject.contentVersions[content.id]) return;
|
||||||
this.addObjectContent(existingObject, content);
|
this.addObjectContent(existingObject, content);
|
||||||
|
didChangeObject = true;
|
||||||
});
|
});
|
||||||
|
if (didChangeObject == false) return;
|
||||||
this.objects.set(existingObject.id, existingObject);
|
this.objects.set(existingObject.id, existingObject);
|
||||||
} else {
|
} else {
|
||||||
this.objects.set(messageObject.id, messageObject);
|
this.objects.set(messageObject.id, messageObject);
|
||||||
|
|||||||
@@ -351,10 +351,14 @@ export class Chat {
|
|||||||
addObject = (messageObject: MessageObject): void => {
|
addObject = (messageObject: MessageObject): void => {
|
||||||
const existingObject = this.objects.value.get(messageObject.id);
|
const existingObject = this.objects.value.get(messageObject.id);
|
||||||
if (existingObject) {
|
if (existingObject) {
|
||||||
|
let didChangeObject = existingObject.title != messageObject.title;
|
||||||
existingObject.title = messageObject.title;
|
existingObject.title = messageObject.title;
|
||||||
Object.values(messageObject.contentVersions).forEach((content) => {
|
Object.values(messageObject.contentVersions).forEach((content) => {
|
||||||
|
if (existingObject.contentVersions[content.id]) return;
|
||||||
this.addObjectContent(existingObject, content);
|
this.addObjectContent(existingObject, content);
|
||||||
|
didChangeObject = true;
|
||||||
});
|
});
|
||||||
|
if (didChangeObject == false) return;
|
||||||
this.objects.set(existingObject.id, existingObject);
|
this.objects.set(existingObject.id, existingObject);
|
||||||
} else {
|
} else {
|
||||||
this.objects.set(messageObject.id, messageObject);
|
this.objects.set(messageObject.id, messageObject);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import * as React from "bloatless-react";
|
|||||||
import { Chat, MessageObject } from "../../Model/chatModel";
|
import { Chat, MessageObject } from "../../Model/chatModel";
|
||||||
|
|
||||||
import { ObjectEntryView } from "./objectEntryView";
|
import { ObjectEntryView } from "./objectEntryView";
|
||||||
import { PlaceholderView } from "./placeholderView";
|
|
||||||
|
|
||||||
export function ObjectGridView(
|
export function ObjectGridView(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
|
|||||||
Reference in New Issue
Block a user