Layout and search fix
🏗️ Build and Test JellyTau / Run Tests (push) Failing after 2m4s
🏗️ Build and Test JellyTau / Android Compile Check (push) Has been skipped
Traceability Validation / Check Requirement Traces (push) Successful in 23s
Build & Release / Run Tests (push) Failing after 2m45s
Build & Release / Build Linux (push) Has been skipped
Build & Release / Build Android (push) Has been skipped
Build & Release / Create Release (push) Has been skipped
🏗️ Build and Test JellyTau / Run Tests (push) Failing after 2m4s
🏗️ Build and Test JellyTau / Android Compile Check (push) Has been skipped
Traceability Validation / Check Requirement Traces (push) Successful in 23s
Build & Release / Run Tests (push) Failing after 2m45s
Build & Release / Build Linux (push) Has been skipped
Build & Release / Build Android (push) Has been skipped
Build & Release / Create Release (push) Has been skipped
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import { auth } from "$lib/stores/auth";
|
||||
import { isConnected } from "$lib/stores/connectivity";
|
||||
|
||||
/**
|
||||
* When true (and offline), library grids reveal greyed-out versions of media
|
||||
@@ -24,6 +25,32 @@ import { auth } from "$lib/stores/auth";
|
||||
*/
|
||||
export const showServerCatalog: Writable<boolean> = writable(false);
|
||||
|
||||
// Keep the backend's offline library queries in sync with the UI toggle. The
|
||||
// offline cache holds the whole synced catalog, so `get_items` would otherwise
|
||||
// return every server item even offline with the toggle off. Include the
|
||||
// non-downloaded catalog only when online (fast browsing reads the same cache)
|
||||
// or when the "Show all server media" toggle is on.
|
||||
let lastIncludeCatalog: boolean | null = null;
|
||||
function pushCatalogVisibility(connected: boolean, showCatalog: boolean): void {
|
||||
const include = connected || showCatalog;
|
||||
if (include === lastIncludeCatalog) return;
|
||||
lastIncludeCatalog = include;
|
||||
commands.setShowServerCatalog(include).catch((err) => {
|
||||
console.warn("[OfflineCatalog] Failed to set catalog visibility:", err);
|
||||
});
|
||||
}
|
||||
|
||||
let connectedNow = true;
|
||||
let showCatalogNow = false;
|
||||
isConnected.subscribe((v) => {
|
||||
connectedNow = v;
|
||||
pushCatalogVisibility(connectedNow, showCatalogNow);
|
||||
});
|
||||
showServerCatalog.subscribe((v) => {
|
||||
showCatalogNow = v;
|
||||
pushCatalogVisibility(connectedNow, showCatalogNow);
|
||||
});
|
||||
|
||||
/** Last time a full catalog sync completed, for a UI hint. */
|
||||
export const lastCatalogSync: Writable<string | null> = writable(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user