Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments

lint

+20 -18
+20 -18
web/src/components/modals/EditHistoryModal.tsx
··· 19 19 const [error, setError] = useState<string | null>(null); 20 20 21 21 useEffect(() => { 22 + const fetchHistory = async () => { 23 + if (!item.uri) return; 24 + 25 + try { 26 + setLoading(true); 27 + setError(null); 28 + const res = await fetch( 29 + `/api/annotations/history?uri=${encodeURIComponent(item.uri)}`, 30 + ); 31 + if (!res.ok) throw new Error("Failed to fetch history"); 32 + const data = await res.json(); 33 + setHistory(data); 34 + } catch (err) { 35 + console.error(err); 36 + setError("Failed to load edit history"); 37 + } finally { 38 + setLoading(false); 39 + } 40 + }; 41 + 22 42 if (isOpen && item.uri) { 23 43 fetchHistory(); 24 44 document.body.style.overflow = "hidden"; ··· 27 47 document.body.style.overflow = "unset"; 28 48 }; 29 49 }, [isOpen, item.uri]); 30 - 31 - const fetchHistory = async () => { 32 - try { 33 - setLoading(true); 34 - setError(null); 35 - const res = await fetch( 36 - `/api/annotations/history?uri=${encodeURIComponent(item.uri)}`, 37 - ); 38 - if (!res.ok) throw new Error("Failed to fetch history"); 39 - const data = await res.json(); 40 - setHistory(data); 41 - } catch (err) { 42 - console.error(err); 43 - setError("Failed to load edit history"); 44 - } finally { 45 - setLoading(false); 46 - } 47 - }; 48 50 49 51 if (!isOpen) return null; 50 52