this repo has no description
0
fork

Configure Feed

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

Fix flash of un-nested comments

+21 -4
+21 -4
src/pages/status.jsx
··· 21 21 const heroStatusRef = useRef(); 22 22 23 23 useEffect(async () => { 24 - // If id is completely new, reset the whole list 25 - if (!statuses.find((s) => s.id === id)) { 24 + const containsStatus = statuses.find((s) => s.id === id); 25 + const statusesWithSameAccountID = statuses.filter( 26 + (s) => s.accountID === containsStatus?.accountID, 27 + ); 28 + if (statusesWithSameAccountID.length > 1) { 29 + setStatuses( 30 + statusesWithSameAccountID.map((s) => ({ 31 + ...s, 32 + thread: true, 33 + descendant: undefined, 34 + ancestor: undefined, 35 + })), 36 + ); 37 + } else { 26 38 setStatuses([{ id }]); 27 39 } 28 40 ··· 76 88 console.log({ ancestors, descendants, nestedDescendants }); 77 89 78 90 const allStatuses = [ 79 - ...ancestors.map((s) => ({ id: s.id, ancestor: true })), 80 - { id }, 91 + ...ancestors.map((s) => ({ 92 + id: s.id, 93 + ancestor: true, 94 + accountID: s.account.id, 95 + })), 96 + { id, accountID: heroStatus.account.id }, 81 97 ...nestedDescendants.map((s) => ({ 82 98 id: s.id, 99 + accountID: s.account.id, 83 100 descendant: true, 84 101 thread: s.account.id === heroStatus.account.id, 85 102 replies: s.__replies?.map((r) => r.id),