this repo has no description
0
fork

Configure Feed

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

More checks on thread contexts

Some instances return really wacky order of posts

+28
+28
src/utils/timeline-utils.jsx
··· 97 97 contexts[contextIndex++] = [item, repliedItem]; 98 98 } 99 99 }); 100 + 101 + // Check for cross-item contexts 102 + // Merge contexts into one if they have a common item (same id) 103 + for (let i = 0; i < contexts.length; i++) { 104 + for (let j = i + 1; j < contexts.length; j++) { 105 + const commonItem = contexts[i].find((t) => contexts[j].includes(t)); 106 + if (commonItem) { 107 + contexts[i] = [...contexts[i], ...contexts[j]]; 108 + // Remove duplicate items 109 + contexts[i] = contexts[i].filter( 110 + (item, index, self) => 111 + self.findIndex((t) => t.id === item.id) === index, 112 + ); 113 + contexts.splice(j, 1); 114 + j--; 115 + } 116 + } 117 + } 118 + 119 + // Sort items by checking inReplyToId 120 + contexts.forEach((context) => { 121 + context.sort((a, b) => { 122 + if (a.inReplyToId === b.id) return -1; 123 + if (b.inReplyToId === a.id) return 1; 124 + return 0; 125 + }); 126 + }); 127 + 100 128 if (contexts.length) console.log('🧵 Contexts', contexts); 101 129 102 130 const newItems = [];