From fc139031633f4591c51f168356653e708040506a Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Fri, 8 Oct 2021 12:29:02 +0200 Subject: [PATCH] get back to stable Signed-off-by: Andrey Platov --- .../src/components/KanbanView.svelte | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/view-resources/src/components/KanbanView.svelte b/plugins/view-resources/src/components/KanbanView.svelte index 787e3d591d..34fb260dd0 100644 --- a/plugins/view-resources/src/components/KanbanView.svelte +++ b/plugins/view-resources/src/components/KanbanView.svelte @@ -80,22 +80,26 @@ const id = dragCard._id const txes: TxCUD[] = [] + if (dragCardInitialState !== state) + client.updateDoc(_class, space, id, { state }) + + if (dragCardInitialPosition !== to) { - txes.push(client.txFactory.createTxUpdateDoc(core.class.SpaceWithStates, core.space.Model, space, { + await client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { $pull: { order: id } - })) + }) - txes.push(client.txFactory.createTxUpdateDoc(core.class.SpaceWithStates, core.space.Model, space, { + client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { $push: { order: { $each: [id], $position: to } } - })) + }) // await client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { // $pull: { @@ -113,13 +117,10 @@ // }) } - if (dragCardInitialState !== state) - txes.push(client.txFactory.createTxUpdateDoc(_class, space, id, { state })) - - if (txes.length > 0) { - const updateTx = client.txFactory.createTxBulkWrite(space, txes) - await client.tx(updateTx) - } + // if (txes.length > 0) { + // const updateTx = client.txFactory.createTxBulkWrite(space, txes) + // await client.tx(updateTx) + // } } function getValue(doc: Doc, key: string): any {