mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 08:22:24 +00:00
Fix future timestamp bug and improve loading spinner UX
This commit is contained in:
1 parent
14d7423e29
commit
bdc86aaef6
2 files changed
+17
-11
No files matched your search
@@ -2698,17 +2698,15 @@ class Application {
|
||||
typeof reason === "string" && reason.trim() ? reason.trim() : undefined;
|
||||
|
||||
if (typeof moderationService?.awaitUserBlockRefresh === "function") {
|
||||
try {
|
||||
await moderationService.awaitUserBlockRefresh();
|
||||
} catch (error) {
|
||||
moderationService.awaitUserBlockRefresh().catch((error) => {
|
||||
const contextMessage = normalizedReason
|
||||
? ` before ${normalizedReason}`
|
||||
: "";
|
||||
? ` in background during ${normalizedReason}`
|
||||
: " in background";
|
||||
devLogger.warn(
|
||||
`Failed to sync moderation summaries${contextMessage}:`,
|
||||
error,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -5359,10 +5357,17 @@ class Application {
|
||||
devLogger.log("Starting loadVideos... (forceFetch =", forceFetch, ")");
|
||||
|
||||
const container = this.mountVideoListView();
|
||||
if (this.videoListView && container) {
|
||||
this.videoListView.showLoading("Fetching recent videos…");
|
||||
} else if (container) {
|
||||
container.innerHTML = getSidebarLoadingMarkup("Fetching recent videos…");
|
||||
const hasCachedVideos =
|
||||
this.nostrService &&
|
||||
Array.isArray(this.nostrService.getFilteredActiveVideos()) &&
|
||||
this.nostrService.getFilteredActiveVideos().length > 0;
|
||||
|
||||
if (!hasCachedVideos) {
|
||||
if (this.videoListView && container) {
|
||||
this.videoListView.showLoading("Fetching recent videos…");
|
||||
} else if (container) {
|
||||
container.innerHTML = getSidebarLoadingMarkup("Fetching recent videos…");
|
||||
}
|
||||
}
|
||||
|
||||
let initialRefreshPromise = null;
|
||||
|
||||
+2
-1
@@ -5629,12 +5629,13 @@ export class NostrClient {
|
||||
|
||||
getLatestCachedCreatedAt() {
|
||||
let latest = 0;
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
|
||||
for (const video of this.allEvents.values()) {
|
||||
const createdAt = Number.isFinite(video?.created_at)
|
||||
? Math.floor(video.created_at)
|
||||
: 0;
|
||||
if (createdAt > latest) {
|
||||
if (createdAt > latest && createdAt <= now) {
|
||||
latest = createdAt;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user