fix(offline): gate library listing to downloaded-only when offline (#10)
The connectivity store now drives the "downloaded only" view so an offline library page shows just on-device media, with the server catalog revealed only when "Show all server media" is toggled. TRACES: UR-052 | DR-078, DR-079
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
// mirrors status; it does not decide reachability itself. navigator.onLine is
|
||||
// advisory and triggers a recheck rather than forcing offline.
|
||||
// See docs/architecture/07-connectivity.md.
|
||||
// TRACES: UR-002 | DR-013
|
||||
// TRACES: UR-002, UR-043, UR-052 | DR-013, DR-055, DR-079
|
||||
|
||||
import { writable, derived } from "svelte/store";
|
||||
import { browser } from "$app/environment";
|
||||
@@ -231,8 +231,20 @@ export const connectivity = createConnectivityStore();
|
||||
// Derived stores for convenience
|
||||
export const isOnline = derived(connectivity, ($c) => $c.isOnline);
|
||||
export const isServerReachable = derived(connectivity, ($c) => $c.isServerReachable);
|
||||
// "Connected" follows backend reachability ALONE — not navigator.onLine.
|
||||
// The Rust ConnectivityMonitor (fed by real repository traffic) is the source
|
||||
// of truth (DR-055); navigator.onLine is advisory and can be wrong (server
|
||||
// unreachable on a live device link — server down, wrong LAN, dropped VPN —
|
||||
// still reports online). Folding it in kept `isConnected` true in exactly those
|
||||
// cases and prevented the offline "downloaded only" gate from ever closing.
|
||||
// navigator.onLine stays a *trigger* for a recheck (the online/offline
|
||||
// listeners call checkServerReachable), never a *term* in this decision.
|
||||
// The startup default (isServerReachable: true) is intentionally optimistic —
|
||||
// a brief full-catalog flash before the first probe beats flipping the app to
|
||||
// "offline" on launch. See docs/architecture/07-connectivity.md.
|
||||
// TRACES: UR-052 | DR-079
|
||||
export const isConnected = derived(
|
||||
connectivity,
|
||||
($c) => $c.isOnline && $c.isServerReachable
|
||||
($c) => $c.isServerReachable
|
||||
);
|
||||
export const connectionError = derived(connectivity, ($c) => $c.connectionError);
|
||||
|
||||
Reference in New Issue
Block a user