From d605d0d5441c5b335e4dbcc5b601e12da6c7ae3d Mon Sep 17 00:00:00 2001 From: archipelago Date: Tue, 28 Jul 2026 04:46:26 -0400 Subject: [PATCH] feat(ui): PeerFiles renders from the shared peer-browse cache (B4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PeerFiles.vue reads the SAME `cloud.peer-browse:` entry Cloud.vue's per-peer fan-in fills, so Cloud → peer files paints instantly from cache and revalidates behind it; catalog/error/loading/transport are now computed views over the store entry. - preview-peer fan-out is capped at 3 concurrent with a queue (was one 30s RPC per media item, all at once, unbounded) and aborts on unmount. - browse + preview RPCs drop to maxRetries:1 — retry×3 turned one slow peer into a 90s spinner. - fix useCachedResource's interface types: `ReturnType>` resolves to the writable overload (WritableComputedRef), which broke vue-tsc against the plain computed() returns; use ComputedRef. Co-Authored-By: Claude Fable 5 --- neode-ui/src/composables/useCachedResource.ts | 12 +-- neode-ui/src/views/PeerFiles.vue | 94 +++++++++++++------ 2 files changed, 72 insertions(+), 34 deletions(-) diff --git a/neode-ui/src/composables/useCachedResource.ts b/neode-ui/src/composables/useCachedResource.ts index 9c2e74b8..28ed43a5 100644 --- a/neode-ui/src/composables/useCachedResource.ts +++ b/neode-ui/src/composables/useCachedResource.ts @@ -22,7 +22,7 @@ // - Abort-on-unmount: the fetcher receives an AbortSignal that fires when // the last subscribed component unmounts. -import { computed, getCurrentScope, onScopeDispose } from 'vue' +import { computed, getCurrentScope, onScopeDispose, type ComputedRef } from 'vue' import { useResourcesStore, type ResourceEntry, type ResourceLoadState } from '@/stores/resources' export interface CachedResourceOptions { @@ -44,12 +44,12 @@ export interface CachedResourceOptions { export interface CachedResource { entry: ResourceEntry /** Convenience computed views over the entry. */ - data: ReturnType> - loadState: ReturnType> - error: ReturnType> + data: ComputedRef + loadState: ComputedRef + error: ComputedRef /** True when data exists but is older than the TTL (drive an age badge). */ - isStale: ReturnType> - ageMs: ReturnType> + isStale: ComputedRef + ageMs: ComputedRef /** Force a refresh now (deduped with any in-flight one). */ refresh: () => Promise /** Mark stale + debounce-refresh all mounted users of this key. */ diff --git a/neode-ui/src/views/PeerFiles.vue b/neode-ui/src/views/PeerFiles.vue index c7e82c82..0caf201b 100644 --- a/neode-ui/src/views/PeerFiles.vue +++ b/neode-ui/src/views/PeerFiles.vue @@ -594,10 +594,11 @@