diff --git a/client/coral-embed/src/index.js b/client/coral-embed/src/index.js index d3715b44d..8d8855aa7 100644 --- a/client/coral-embed/src/index.js +++ b/client/coral-embed/src/index.js @@ -31,13 +31,14 @@ function buildStreamIframeUrl(talkBaseUrl, asset_url, comment, asset_id) { function configurePymParent(pymParent, asset_url) { let notificationOffset = 200; let ready = false; + let cachedHeight; // Resize parent iframe height when child height changes pymParent.onMessage('height', function(height) { - - // TODO: In local testing, this is firing nonstop. Maybe there's a bug on the inside? - // Or it's by design of pym... but that's very wasteful of CPU and DOM reflows (jank) - pymParent.el.querySelector('iframe').height = `${height }px`; + if (height !== cachedHeight) { + pymParent.el.firstChild.style.height = `${height}px`; + cachedHeight = height; + } }); // Helps child show notifications at the right scrollTop