From 173c062369c46e0b0fd5155bace070ec2f360655 Mon Sep 17 00:00:00 2001
From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
Date: Fri, 11 Mar 2022 15:05:03 +0600
Subject: [PATCH] Minor fix (#1126)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
---
 server/core/src/storage.ts | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/server/core/src/storage.ts b/server/core/src/storage.ts
index aa751dadc2..77c474021f 100644
--- a/server/core/src/storage.ts
+++ b/server/core/src/storage.ts
@@ -160,15 +160,19 @@ class TServerStorage implements ServerStorage {
           const baseClass = this.hierarchy.getBaseClass(_class)
           if (baseClass !== _class) {
             // Mixin opeeration is required.
-            return [txFactory.createTxMixin(_id, attachedTo._class, attachedTo.space, _class, {
+            const tx = txFactory.createTxMixin(_id, attachedTo._class, attachedTo.space, _class, {
               $inc: { [colTx.collection]: isCreateTx ? 1 : -1 }
-            })]
+            })
+            tx.modifiedOn = colTx.modifiedOn
+
+            return [tx]
           } else {
-            return [
-              txFactory.createTxUpdateDoc(_class, attachedTo.space, _id, {
-                $inc: { [colTx.collection]: isCreateTx ? 1 : -1 }
-              })
-            ]
+            const tx = txFactory.createTxUpdateDoc(_class, attachedTo.space, _id, {
+              $inc: { [colTx.collection]: isCreateTx ? 1 : -1 }
+            })
+            tx.modifiedOn = colTx.modifiedOn
+
+            return [tx]
           }
         }
       }
@@ -198,7 +202,7 @@ class TServerStorage implements ServerStorage {
     const _class = txClass(tx)
     const objClass = txObjectClass(tx)
     return await ctx.with('tx', { _class, objClass }, async (ctx) => {
-      if (tx.objectSpace !== core.space.DerivedTx) {
+      if (tx.space !== core.space.DerivedTx) {
         await ctx.with('domain-tx', { _class, objClass }, async () => await this.getAdapter(DOMAIN_TX).tx(tx))
       }