From f85b9a3a1daa2b2669c3d6de5de14cba279a54fe Mon Sep 17 00:00:00 2001 From: keyan Date: Thu, 10 Mar 2022 10:09:05 -0600 Subject: [PATCH] always assume twitter overflows --- components/item-full.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/components/item-full.js b/components/item-full.js index 5db773bb..3ecfd75c 100644 --- a/components/item-full.js +++ b/components/item-full.js @@ -10,7 +10,7 @@ import { Button } from 'react-bootstrap' import { TwitterTweetEmbed } from 'react-twitter-embed' import YouTube from 'react-youtube' import useDarkMode from 'use-dark-mode' -import { useEffect, useRef, useState } from 'react' +import { useState } from 'react' function BioItem ({ item, handleClick }) { const me = useMe() @@ -53,27 +53,12 @@ function ItemEmbed ({ item }) { const darkMode = useDarkMode() const [overflowing, setOverflowing] = useState(false) const [show, setShow] = useState(false) - const containerRef = useRef(null) - - const checkOverflow = () => { - const cont = containerRef.current - const over = cont && (cont.offsetHeight < cont.scrollHeight || cont.offsetWidth < cont.scrollWidth) - - if (over) { - setOverflowing(true) - return - } - - setOverflowing(false) - } - - useEffect(checkOverflow, []) const twitter = item.url?.match(/^https?:\/\/twitter\.com\/(?:#!\/)?\w+\/status(?:es)?\/(?\d+)/) if (twitter?.groups?.id) { return ( -
- } onLoad={checkOverflow} /> +
+ } onLoad={() => setOverflowing(true)} /> {overflowing && !show &&