Browse Source

Fix ResizeObserver warnings (#6546)

device-manager-types
Artur Arseniev 8 months ago
committed by GitHub
parent
commit
1c478d2909
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      packages/core/src/canvas/view/FrameWrapView.ts

9
packages/core/src/canvas/view/FrameWrapView.ts

@ -170,9 +170,12 @@ export default class FrameWrapView extends ModuleView<Frame> {
if (contentDocument) {
const observer = new ResizeObserver(() => {
const minHeight = parseFloat(model.get('minHeight')) || 0;
const heightResult = Math.max(contentDocument.body.scrollHeight, minHeight);
style.height = `${heightResult}px`;
// This prevents "ResizeObserver loop completed with undelivered notifications"
requestAnimationFrame(() => {
const minHeight = parseFloat(model.get('minHeight')) || 0;
const heightResult = Math.max(contentDocument.body.scrollHeight, minHeight);
style.height = `${heightResult}px`;
});
});
observer.observe(contentDocument.body);
this.sizeObserver = observer;

Loading…
Cancel
Save