Updates
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user