Skip to content

Commit

Permalink
Merge pull request #346 from mathuo/344-floating-tab-groups-move-in-b…
Browse files Browse the repository at this point in the history
…ested-dockview

bug: skip resize for unmounted elements
  • Loading branch information
mathuo authored Oct 1, 2023
2 parents 9006fb9 + 19595f3 commit a96400d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/dockview-core/src/resizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ export abstract class Resizable extends CompositeDisposable {
*/
return;
}

if (!document.body.contains(this._element)) {
/**
* since the event is dispatched through requestAnimationFrame there is a small chance
* the component is no longer attached to the DOM, if that is the case the dimensions
* are mostly likely all zero and meaningless. we should skip this case.
*/
return;
}

const { width, height } = entry.contentRect;
this.layout(width, height);
})
Expand Down

0 comments on commit a96400d

Please sign in to comment.