Merge pull request #346 from mathuo/344-floating-tab-groups-move-in-bested-dockview

bug: skip resize for unmounted elements
This commit is contained in:
mathuo 2023-10-01 20:45:31 +01:00 committed by GitHub
commit a96400d970
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
})