Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: skip resize for unmounted elements #346

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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