diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 94694885..7a18c3fd 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -245,6 +245,7 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { }, [id, uiState !== 'loading']); const scrollOffsets = useRef(); + const lastInitContextTS = useRef(); const initContext = ({ reloadHero } = {}) => { console.debug('initContext', id); setUIState('loading'); @@ -432,12 +433,31 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { } })(); + lastInitContextTS.current = Date.now(); + return () => { clearTimeout(heroTimer); }; }; useEffect(initContext, [id, masto]); + + const [showRefresh, setShowRefresh] = useState(false); + useEffect(() => { + let interval = setInterval(() => { + const now = Date.now(); + if ( + lastInitContextTS.current && + now - lastInitContextTS.current >= 60_000 + ) { + setShowRefresh(true); + } + }, 60_000); // 1 minute + return () => { + clearInterval(interval); + }; + }, []); + useLayoutEffect(() => { if (!statuses.length) return; console.debug('STATUSES', statuses); @@ -1095,6 +1115,18 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { > + {showRefresh && ( + + )}