Skip to content

web-app-ai-smart-collections-nav: cache recent-files/collection results across mounts #504

Description

@LukasHirt

Summary

CollectionsView.vue re-runs the full pipeline — space fan-out (useRecentFiles), per-file excerpt fetch, and LLM clustering (useCollections) — from scratch on every mount (onMounted(loadAndCluster)). There is no caching of the resulting recentFiles/collections, so navigating away from the Collections view and back pays the full IO + LLM cost again.

This is in contrast to the session consent flag (useConsent.ts), which is cached at module scope for the lifetime of the SPA session.

Proposal

Cache the last successful recentFiles/collections result at module scope (or in a small composable), consulted on mount to skip the fan-out/LLM call when a cache is warm, with an explicit "Refresh" action in the UI to invalidate it and re-fetch.

Context

Raised in the automated review on #498 (verdict: "Commenting", non-blocking) as a real but non-correctness/non-security inefficiency. Deferred out of that PR as a follow-up; the other eight findings from that review (prompt injection, batch-failure data loss, masked outage, consent-gating test coverage, dependency drift, stray .gitignore entries, placeholder description, and the inefficient excerpt fetch) were addressed directly in #498.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions