mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 02:42:27 +08:00
fix(client): undefined entity in some cases
This commit is contained in:
parent
1e182f5820
commit
d684440c1f
@ -1,12 +1,16 @@
|
|||||||
import type { EntityRowNames } from "./services/load_results.js";
|
import type { EntityRowNames } from "./services/load_results.js";
|
||||||
|
|
||||||
|
interface Entity {
|
||||||
|
isDeleted?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Deduplicate with src/services/entity_changes_interface.ts
|
// TODO: Deduplicate with src/services/entity_changes_interface.ts
|
||||||
export interface EntityChange {
|
export interface EntityChange {
|
||||||
id?: number | null;
|
id?: number | null;
|
||||||
noteId?: string;
|
noteId?: string;
|
||||||
entityName: EntityRowNames;
|
entityName: EntityRowNames;
|
||||||
entityId: string;
|
entityId: string;
|
||||||
entity?: any;
|
entity?: Entity;
|
||||||
positions?: Record<string, number>;
|
positions?: Record<string, number>;
|
||||||
hash: string;
|
hash: string;
|
||||||
utcDateChanged?: string;
|
utcDateChanged?: string;
|
||||||
|
@ -290,14 +290,16 @@ function processAttachment(loadResults: LoadResults, ec: EntityChange) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachment) {
|
if (ec.entity) {
|
||||||
attachment.update(ec.entity as FAttachmentRow);
|
if (attachment) {
|
||||||
} else {
|
attachment.update(ec.entity as FAttachmentRow);
|
||||||
const attachmentRow = ec.entity as FAttachmentRow;
|
} else {
|
||||||
const note = froca.notes[attachmentRow.ownerId];
|
const attachmentRow = ec.entity as FAttachmentRow;
|
||||||
|
const note = froca.notes[attachmentRow.ownerId];
|
||||||
|
|
||||||
if (note?.attachments) {
|
if (note?.attachments) {
|
||||||
note.attachments.push(new FAttachment(froca, attachmentRow));
|
note.attachments.push(new FAttachment(froca, attachmentRow));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user