Improve relay hygiene and count status

This commit is contained in:
thePR0M3TH3AN committed 2026-01-29 09:58:35 -05:00
1 parent 6ae4b7ab4f
commit c3e986c9d3
12 files changed
+286 -59

No files matched your search

+10 -4
View File
@@ -6201,11 +6201,16 @@ export class VideoModal {
try {
const token = subscribeToVideoViewCount(
pointerInfo.pointer,
({ total, status }) => {
({ total, status, partial }) => {
if (!viewEl || !viewEl.isConnected) {
return;
}
viewEl.textContent = this.getViewCountLabel(total, status);
viewEl.textContent = this.getViewCountLabel(total, status, partial);
if (partial) {
viewEl.dataset.viewCountState = "partial";
} else {
viewEl.dataset.viewCountState = status;
}
}
);
return { pointer: pointerInfo.pointer, token };
@@ -6216,9 +6221,10 @@ export class VideoModal {
}
}
getViewCountLabel(total, status) {
getViewCountLabel(total, status, partial) {
if (Number.isFinite(total)) {
return this.formatViewCountLabel(Number(total));
const label = this.formatViewCountLabel(Number(total));
return partial ? `${label} (partial)` : label;
}
if (status === "hydrating") {
return "Loading…";