From d89b8827ea99555b21ce376e75e98a17472958ed Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Thu, 7 Oct 2021 22:38:05 +0200 Subject: [PATCH] important `client` fix Signed-off-by: Andrey Platov --- packages/presentation/src/utils.ts | 3 +- .../src/components/KanbanView.svelte | 42 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index 794f1e93dd..bb781c0d0a 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -39,7 +39,8 @@ class UIClient extends TxOperations implements Client { } tx(tx: Tx): Promise { - return Promise.all([super.tx(tx), this.liveQuery.tx(tx)]) as unknown as Promise + // return Promise.all([super.tx(tx), this.liveQuery.tx(tx)]) as unknown as Promise + return super.tx(tx) } } diff --git a/plugins/view-resources/src/components/KanbanView.svelte b/plugins/view-resources/src/components/KanbanView.svelte index 359c104db1..6b6a93319a 100644 --- a/plugins/view-resources/src/components/KanbanView.svelte +++ b/plugins/view-resources/src/components/KanbanView.svelte @@ -84,32 +84,13 @@ if (dragCardInitialPosition !== to) { - // const remove = client.txFactory.createTxUpdateDoc(core.class.SpaceWithStates, core.space.Model, space, { - // $pull: { - // order: id - // } - // }) - - // const add = client.txFactory.createTxUpdateDoc(core.class.SpaceWithStates, core.space.Model, space, { - // $push: { - // order: { - // $each: [id], - // $position: to - // } - // } - // }) - - // const updateTx = client.txFactory.createTxBulkWrite(core.space.Model, [remove, add]) - - // await client.tx(updateTx) - - await client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { + const remove = client.txFactory.createTxUpdateDoc(core.class.SpaceWithStates, core.space.Model, space, { $pull: { order: id } }) - client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { + const add = client.txFactory.createTxUpdateDoc(core.class.SpaceWithStates, core.space.Model, space, { $push: { order: { $each: [id], @@ -117,6 +98,25 @@ } } }) + + const updateTx = client.txFactory.createTxBulkWrite(core.space.Model, [remove, add]) + + await client.tx(updateTx) + + // await client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { + // $pull: { + // order: id + // } + // }) + + // client.updateDoc(core.class.SpaceWithStates, core.space.Model, space, { + // $push: { + // order: { + // $each: [id], + // $position: to + // } + // } + // }) } }