From 56bdec846c4b1b76991b104e896aaaca95c06ecc Mon Sep 17 00:00:00 2001 From: mathuo <6710312+mathuo@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:40:49 +0000 Subject: [PATCH] bug: wrong event ordering --- .../src/dockview/dockviewComponent.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/dockview-core/src/dockview/dockviewComponent.ts b/packages/dockview-core/src/dockview/dockviewComponent.ts index 5a20f5b84..c1899e7f0 100644 --- a/packages/dockview-core/src/dockview/dockviewComponent.ts +++ b/packages/dockview-core/src/dockview/dockviewComponent.ts @@ -659,20 +659,23 @@ export class DockviewComponent const isGroupAddedToDom = referenceGroup.element.parentElement !== null; - const group = !isGroupAddedToDom - ? referenceGroup - : options?.overridePopoutGroup ?? - this.createGroup({ id: groupId }); + let group: DockviewGroupPanel; + + if (!isGroupAddedToDom) { + group = referenceGroup; + } else if (options?.overridePopoutGroup) { + group = options.overridePopoutGroup; + } else { + group = this.createGroup({ id: groupId }); + this._onDidAddGroup.fire(group); + } + group.model.renderContainer = overlayRenderContainer; group.layout( _window.window!.innerWidth, _window.window!.innerHeight ); - if (!this._groups.has(group.api.id)) { - this._onDidAddGroup.fire(group); - } - if (!options?.overridePopoutGroup && isGroupAddedToDom) { if (itemToPopout instanceof DockviewPanel) { this.movingLock(() => {