fix: update iframe size on mount

This commit is contained in:
Pavel Mineev
2022-11-29 18:12:14 -06:00
committed by Umputun
parent f1b65db2c7
commit ba19bcc729
@@ -305,10 +305,9 @@ function Comments({ isLoading, topComments, commentsShown, showMore }: CommentsP
return;
}
updateIframeHeight();
// TODO: throttle updates
const observer = new MutationObserver(() => {
updateIframeHeight();
// a hacky way to force iframe height update when new image is rendered and loaded
rootRef.current?.querySelectorAll('img').forEach((img) => {
img.addEventListener('load', updateIframeHeight);