fix(client): undefined entity in some cases

This commit is contained in:
Elian Doran 2025-01-16 18:36:23 +02:00
parent 1e182f5820
commit d684440c1f
No known key found for this signature in database
2 changed files with 14 additions and 8 deletions

View File

@ -1,12 +1,16 @@
import type { EntityRowNames } from "./services/load_results.js";
interface Entity {
isDeleted?: boolean;
}
// TODO: Deduplicate with src/services/entity_changes_interface.ts
export interface EntityChange {
id?: number | null;
noteId?: string;
entityName: EntityRowNames;
entityId: string;
entity?: any;
entity?: Entity;
positions?: Record<string, number>;
hash: string;
utcDateChanged?: string;

View File

@ -290,6 +290,7 @@ function processAttachment(loadResults: LoadResults, ec: EntityChange) {
return;
}
if (ec.entity) {
if (attachment) {
attachment.update(ec.entity as FAttachmentRow);
} else {
@ -300,6 +301,7 @@ function processAttachment(loadResults: LoadResults, ec: EntityChange) {
note.attachments.push(new FAttachment(froca, attachmentRow));
}
}
}
loadResults.addAttachmentRow(attachmentEntity);
}