Attempt to fix <ConversationHero> re-rendering

This commit is contained in:
Evan Hahn 2021-08-18 11:38:47 -05:00 committed by GitHub
parent 7a8363c7c8
commit f3ba979246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,6 +140,9 @@ export const ConversationHero = ({
// this will cause a re-render loop. // this will cause a re-render loop.
const previousHeight = previousHeightRef.current; const previousHeight = previousHeightRef.current;
if (previousHeight && height && previousHeight !== height) { if (previousHeight && height && previousHeight !== height) {
window.log.info(
`ConversationHero height changed from ${previousHeight} to ${height}`
);
onHeightChange?.(); onHeightChange?.();
} }
}, [height, onHeightChange]); }, [height, onHeightChange]);
@ -176,7 +179,7 @@ export const ConversationHero = ({
bounds bounds
onResize={({ bounds }) => { onResize={({ bounds }) => {
assert(bounds, 'We should be measuring the bounds'); assert(bounds, 'We should be measuring the bounds');
setHeight(bounds.height); setHeight(Math.ceil(bounds.height));
}} }}
> >
{({ measureRef }) => ( {({ measureRef }) => (