From fd13e7f4460e25b5cf6b17dbaee22b1ac214a0c4 Mon Sep 17 00:00:00 2001 From: Ruslan Bayandinov <45530296+wazsone@users.noreply.github.com> Date: Fri, 28 Oct 2022 20:44:33 +0700 Subject: [PATCH] Fix/tsk 218 (#2335) Signed-off-by: Ruslan Bayandinov --- models/tracker/src/index.ts | 2 +- packages/query/src/index.ts | 9 ++++++++- plugins/view-resources/src/actionImpl.ts | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index f42120e500..8f233e4419 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -916,7 +916,7 @@ export function createModel (builder: Builder): void { component: tracker.component.SetParentIssueActionPopup, element: 'top', fillProps: { - _object: 'value' + _objects: 'value' } }, label: tracker.string.SetParent, diff --git a/packages/query/src/index.ts b/packages/query/src/index.ts index e78acc8612..4f50fb6d47 100644 --- a/packages/query/src/index.ts +++ b/packages/query/src/index.ts @@ -547,7 +547,14 @@ export class LiveQuery extends TxProcessor implements Client { if (q.result instanceof Promise) { q.result = await q.result } - q.result.push(res[0]) + const doc = res[0] + const pos = q.result.findIndex((el) => el._id === doc._id) + if (pos !== -1) { + q.result[pos] = doc + } else { + q.result.push(doc) + q.total++ + } return true } } diff --git a/plugins/view-resources/src/actionImpl.ts b/plugins/view-resources/src/actionImpl.ts index 85ef092c82..15e6efda16 100644 --- a/plugins/view-resources/src/actionImpl.ts +++ b/plugins/view-resources/src/actionImpl.ts @@ -221,6 +221,8 @@ async function ShowPopup ( } if (docKey === '_object') { ;(cprops as any)[propKey] = docs[0] + } else if (docKey === '_objects') { + ;(cprops as any)[propKey] = docs.length === 1 ? docs[0] : docs } }