diff --git a/src/utils/Transaction.js b/src/utils/Transaction.js
index 865e727c..a9ab6afa 100644
--- a/src/utils/Transaction.js
+++ b/src/utils/Transaction.js
@@ -331,8 +331,8 @@ const cleanupTransactions = (transactionCleanups, i) => {
         }
       }
       if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) {
-        doc.clientID = generateNewClientId()
         logging.print(logging.ORANGE, logging.BOLD, '[yjs] ', logging.UNBOLD, logging.RED, 'Changed the client-id because another client seems to be using it.')
+        doc.clientID = generateNewClientId()
       }
       // @todo Merge all the transactions into one and provide send the data as a single update message
       doc.emit('afterTransactionCleanup', [transaction, doc])