mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
Channel grid: add [channel-load] diagnostics to trace where videos drop
Temporary dev-mode logging to pinpoint why a known video (e.g. a whitelisted creator's NIP-71 video) never renders on their channel wall: - loadUserVideos logs the relay set size, relay event count + kind breakdown, and the cache event count. - buildRenderableChannelVideos logs per-stage counts: input → converted → uniqueById → byRoot → afterDeleted, plus drop counts for blacklist/canAccess and the final render count. devLogger.info → visible in dev mode only (localhost), no prod noise. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
013b0344b9
commit
31848a1e51
1 file changed
+24
@@ -4610,22 +4610,34 @@ function buildRenderableChannelVideos({ events = [], app } = {}) {
|
||||
dedupeVideos(uniqueVideos);
|
||||
|
||||
let videos = newestByRoot.filter((video) => !video.deleted);
|
||||
const afterDeleted = videos.length;
|
||||
let dropBlacklist = 0;
|
||||
let dropAccess = 0;
|
||||
videos = videos.filter((video) => {
|
||||
if (!video || !video.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (app?.blacklistedEventIds?.has?.(video.id)) {
|
||||
dropBlacklist += 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!accessControl.canAccess(video)) {
|
||||
dropAccess += 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// [channel-load] diagnostics: where do a channel's videos get dropped?
|
||||
devLogger.info(
|
||||
`[channel-load] build: input=${events.length} converted=${convertedVideos.length} ` +
|
||||
`uniqueById=${uniqueVideos.length} byRoot=${newestByRoot.length} afterDeleted=${afterDeleted} ` +
|
||||
`dropBlacklist=${dropBlacklist} dropAccess=${dropAccess} final=${videos.length}`,
|
||||
);
|
||||
|
||||
videos.sort((a, b) => b.created_at - a.created_at);
|
||||
return videos;
|
||||
}
|
||||
@@ -5652,6 +5664,18 @@ async function loadUserVideos(pubkey) {
|
||||
await renderInFlight;
|
||||
await ensureAccessPromise;
|
||||
|
||||
// [channel-load] diagnostics: what did the relays + cache actually return?
|
||||
const kindCounts = events.reduce((acc, evt) => {
|
||||
const k = evt?.kind;
|
||||
acc[k] = (acc[k] || 0) + 1;
|
||||
return acc;
|
||||
}, {});
|
||||
devLogger.info(
|
||||
`[channel-load] pubkey=${(pubkey || "").slice(0, 8)} relays=${relayList.length} ` +
|
||||
`relayEvents=${events.length} kinds=${JSON.stringify(kindCounts)} ` +
|
||||
`cacheEvents=${getCachedChannelVideoEvents(pubkey).length}`,
|
||||
);
|
||||
|
||||
if (loadToken !== currentVideoLoadToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user