diff --git a/packages/dockview-core/src/api/dockviewGroupPanelApi.ts b/packages/dockview-core/src/api/dockviewGroupPanelApi.ts index 33d97b8a6..b13bd8fd9 100644 --- a/packages/dockview-core/src/api/dockviewGroupPanelApi.ts +++ b/packages/dockview-core/src/api/dockviewGroupPanelApi.ts @@ -28,8 +28,7 @@ export interface DockviewGroupPanelFloatingChangeEvent { readonly location: DockviewGroupLocation; } -// TODO find a better way to initialize and avoid needing null checks -const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized'; +const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized'; export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl { private readonly _mutableDisposable = new MutableDisposable(); @@ -130,15 +129,16 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl { } initialize(group: DockviewGroupPanel): void { - this._group = group; - /** - * TODO: Annoying initialization order caveat + * TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks * * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup. * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has * finished ensuring the `model` is defined. */ + + this._group = group; + queueMicrotask(() => { this._mutableDisposable.value = this._group!.model.onDidActivePanelChange((event) => { diff --git a/packages/dockview-core/src/dnd/dataTransfer.ts b/packages/dockview-core/src/dnd/dataTransfer.ts index 150b60cbc..65482d09a 100644 --- a/packages/dockview-core/src/dnd/dataTransfer.ts +++ b/packages/dockview-core/src/dnd/dataTransfer.ts @@ -1,7 +1,5 @@ class TransferObject { - constructor() { - // intentionally empty class - } + // intentionally empty class } export class PanelTransfer extends TransferObject { diff --git a/packages/dockview-core/src/dockview/dockviewComponent.ts b/packages/dockview-core/src/dockview/dockviewComponent.ts index c4e71f34f..4b85fcb74 100644 --- a/packages/dockview-core/src/dockview/dockviewComponent.ts +++ b/packages/dockview-core/src/dockview/dockviewComponent.ts @@ -828,7 +828,7 @@ export class DockviewComponent this.updateWatermark(); }) .catch((err) => { - console.error(err); + console.error('dockview: failed to create popout window', err); }); } @@ -2104,7 +2104,7 @@ export class DockviewComponent if (id && this._groups.has(options.id!)) { console.warn( - `Duplicate group id ${options?.id}. reassigning group id to avoid errors` + `dockview: Duplicate group id ${options?.id}. reassigning group id to avoid errors` ); id = undefined; } diff --git a/packages/dockview-core/src/events.ts b/packages/dockview-core/src/events.ts index 8916543c5..5c7d0d260 100644 --- a/packages/dockview-core/src/events.ts +++ b/packages/dockview-core/src/events.ts @@ -69,7 +69,7 @@ class Stacktrace { private constructor(readonly value: string) {} print(): void { - console.warn(this.value); + console.warn('dockview: stacktrace', this.value); } } @@ -124,7 +124,7 @@ export class Emitter implements IDisposable { this._listeners.splice(index, 1); } else if (Emitter.ENABLE_TRACKING) { // console.warn( - // `Listener already disposed`, + // `dockview: listener already disposed`, // Stacktrace.create().print() // ); } @@ -158,7 +158,10 @@ export class Emitter implements IDisposable { queueMicrotask(() => { // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block for (const listener of this._listeners) { - console.warn(listener.stacktrace?.print()); + console.warn( + 'dockview: stacktrace', + listener.stacktrace?.print() + ); } }); }