this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update poll at point of expiry

+25
+25
src/components/status.jsx
··· 926 926 927 927 const expiresAtDate = !!expiresAt && new Date(expiresAt); 928 928 929 + // Update poll at point of expiry 930 + useEffect(() => { 931 + let timeout; 932 + if (!expired && expiresAtDate) { 933 + const ms = expiresAtDate.getTime() - Date.now() + 1; // +1 to give it a little buffer 934 + if (ms > 0) { 935 + timeout = setTimeout(() => { 936 + setUIState('loading'); 937 + (async () => { 938 + try { 939 + const pollResponse = await masto.poll.fetch(id); 940 + onUpdate(pollResponse); 941 + } catch (e) { 942 + // Silent fail 943 + } 944 + setUIState('default'); 945 + })(); 946 + }, ms); 947 + } 948 + } 949 + return () => { 950 + clearTimeout(timeout); 951 + }; 952 + }, [expired, expiresAtDate]); 953 + 929 954 const pollVotesCount = votersCount || votesCount; 930 955 let roundPrecision = 0; 931 956 if (pollVotesCount <= 1000) {