From 5eaaa3f8a6b942505855824c3ba82f9546d68230 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Wed, 7 Jun 2023 20:06:59 +0600 Subject: [PATCH] Fix inbox reading (#3390) Signed-off-by: Denis Bykhov --- .../src/components/Inbox.svelte | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/notification-resources/src/components/Inbox.svelte b/plugins/notification-resources/src/components/Inbox.svelte index c6a5756562..721747092c 100644 --- a/plugins/notification-resources/src/components/Inbox.svelte +++ b/plugins/notification-resources/src/components/Inbox.svelte @@ -49,6 +49,7 @@ let _id: Ref | undefined let _class: Ref> | undefined let selectedEmployee: Ref | undefined = undefined + const prevValue: DocUpdates | undefined = undefined async function select (value: DocUpdates | undefined) { if (!value) { @@ -57,17 +58,15 @@ _class = undefined return } + if (prevValue !== undefined) { + await client.update(prevValue, { txes: prevValue.txes }) + } const targetClass = hierarchy.getClass(value.attachedToClass) const panelComponent = hierarchy.as(targetClass, view.mixin.ObjectPanel) component = panelComponent.component ?? view.component.EditDoc _id = value.attachedTo _class = value.attachedToClass - await read(value) - } - - async function read (docUpdate: DocUpdates): Promise { - docUpdate.txes.forEach((p) => (p.isNew = false)) - await client.update(docUpdate, { txes: docUpdate.txes }) + value.txes.forEach((p) => (p.isNew = false)) } function openDM (value: Ref) {