This commit is contained in:
Raven Scott
2025-12-17 20:49:34 -05:00
parent a977320bfc
commit 00709cb446
10 changed files with 4191 additions and 49 deletions
+9 -16
View File
@@ -107,24 +107,17 @@ window.tabs = {
<td class="p-3">${item.isLocal && item.hash !== 'internal' ? `<button onclick="removeDomain('${item.domain}')" class="px-2 py-1 bg-red-500 text-white rounded hover:bg-red-600">Remove</button>` : ''}</td>`;
return tr;
},
postFetch: async (data) => {
// Fetch consensus states for all domains
const domainsWithConsensus = await Promise.all(data.map(async (item) => {
if (item.hash === 'internal' || item.hash === 'none') {
postFetch: (data) => {
// Data already contains consensusState from backend
return data.map(item => {
if (item.consensusStatus === 'internal' || item.hash === 'internal' || item.hash === 'none') {
return { ...item, consensusStatus: 'internal' };
}
try {
const consensusRes = await fetch(`/api/consensus/${encodeURIComponent(item.domain)}`);
if (consensusRes.ok) {
const consensusState = await consensusRes.json();
return { ...item, consensusStatus: consensusState.status, consensusState };
}
} catch (err) {
console.error(`Failed to fetch consensus for ${item.domain}:`, err);
}
return { ...item, consensusStatus: 'unknown' };
}));
return domainsWithConsensus;
return {
...item,
consensusStatus: item.consensusState?.status || 'unknown'
};
});
}
},
entries: {
+1 -1
View File
@@ -25,7 +25,7 @@ async function genericFetch(tabId, shouldRender = true) {
window[config.dataKey] = data;
// Reset infinite scroll state when fetching fresh data
if (window.infiniteScrollState && window.infiniteScrollState[tabId]) {
if (shouldRender && window.infiniteScrollState && window.infiniteScrollState[tabId]) {
window.infiniteScrollState[tabId].loadedCount = 0;
window.infiniteScrollState[tabId].lastQuery = '';
// Disconnect existing observer