Skip to content

Fix #10: Add data-layer caching to eliminate repeated Firestore reads#11

Merged
cak merged 8 commits into
mainfrom
fix/10-local-cache-firestore
Apr 27, 2026
Merged

Fix #10: Add data-layer caching to eliminate repeated Firestore reads#11
cak merged 8 commits into
mainfrom
fix/10-local-cache-firestore

Conversation

@cak
Copy link
Copy Markdown
Member

@cak cak commented Apr 27, 2026

Fixes #10 by introducing a small data-access cache to reduce repeated Firestore reads during navigation.

What changed

  • Added src/lib/db/cache.ts

    • Namespaced keys (htw:v1)
    • In-memory cache for same-session reuse
    • localStorage persistence with TTL
    • Safe JSON parsing and error handling
  • Updated DB access functions (conferences, events, tags, speakers)

    • Cache-first reads
    • Firestore fallback on miss or stale data
  • Event lookups

    • Prefer cached full conference event list before individual fetches
  • Speaker lookups

    • Reuse cached full speaker lists and individual entries

Behavior

  • First load still fetches from Firestore
  • Subsequent navigation reuses cached data
  • Schedule ↔ event navigation is now effectively instant
  • Cache is time-bounded and safely ignored if stale or invalid

@cak cak merged commit 64edf9d into main Apr 27, 2026
@cak cak deleted the fix/10-local-cache-firestore branch April 29, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UX feedback: The site is (way) too slow?

1 participant