From 3b97b7a04397876967b3e498f495764647dd42db Mon Sep 17 00:00:00 2001 From: mohamed yahia Date: Wed, 3 Sep 2025 11:34:56 +0300 Subject: [PATCH] [#6587]: Fix infinite text nodes on dragging into a symbol (#6600) * [#6587]: Fix infinite text nodes on dragging into a symbol * Fix race condition during storing project data * Update bug fix --- packages/core/src/editor/model/Editor.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/core/src/editor/model/Editor.ts b/packages/core/src/editor/model/Editor.ts index 5fb4ac329..a13d954ad 100644 --- a/packages/core/src/editor/model/Editor.ts +++ b/packages/core/src/editor/model/Editor.ts @@ -119,6 +119,7 @@ export default class EditorModel extends Model { destroyed = false; _config: InitEditorConfig; _storageTimeout?: ReturnType; + _isStoring: boolean = false; attrsOrig: any; timedInterval?: ReturnType; updateItr?: ReturnType; @@ -869,9 +870,19 @@ export default class EditorModel extends Model { * @public */ async store(options?: T) { + if (this._isStoring) return; + this._isStoring = true; + // We use a 1ms timeout to defer the cleanup to the next tick of the event loop. + // This prevents a race condition where a store operation, like 'sync:content', + // might increase the dirty count before it can be properly cleared. + setTimeout(() => { + this.clearDirtyCount(); + }, 1); const data = this.storeData(); await this.Storage.store(data, options); - this.clearDirtyCount(); + setTimeout(() => { + this._isStoring = false; + }, 1); return data; }