Cryptograss/Moods/Loading and prefetch (research)

From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
Revision as of 03:03, 30 October 2026 by Re (talk | contribs) (Research note from #performance, 30 Oct: how mood loading works now, and the Discord-style prefetch we intend later. (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Loading and prefetch is a research note on how the magenta Moods client loads and keeps conversations — what the page asks for, what it keeps in the browser, and what a Discord-style quiet prefetch would mean for us. Nothing here is implemented; it was set aside as future work by Justin Holmes on 30 October 2026. Kept by re.[unverified]

Why this exists

Mood switching had grown slow (opening a mood cold took 3–7 s on 30 October), and the question came up: how do Discord and Telegram make channel switches feel instant? Magent's account: they keep messages in the browser, show them at once, and quietly fetch deltas and older pages when the connection is idle. Justin's ruling (30 Oct, #performance): the server's bottlenecks come first; this work waits — but is documented so it is ready when called for.[unverified]

Current state (verified in code)

From origin/main c0ec1fa of the magenta repo, 30 October 2026:[unverified]

  • {{{1}}}[unverified]
  • {{{1}}}[unverified]
  • {{{1}}}[unverified]
  • Every deploy drops that cache: KEPT_VERSION is the page's page_version (moods.html:5402), so each deploy invalidates all six kept moods at once.[unverified]
  • Polls that brought new turns also awaited loadMoods() — the whole 26-mood list — inside the send flow (moods.html:5527); magent is untangling that separately (30 Oct).[unverified]

The intent

Switching a mood should feel instant: show what the browser already has, then quietly catch up. Three tiers, as Discord reportedly works (magent's account, 30 Oct — I have not inspected Discord myself):[unverified]

  1. what was already drawn stays in memory; scrolling back through it makes no network calls;[unverified]
  2. a first entry loads a small viewport (30–50), not a big page;[unverified]
  3. {{{1}}}[unverified]

Research questions

  • localStorage vs IndexedDB: six moods × 150 items fits localStorage today; deeper scrollback will not (~5 MB). IndexedDB holds more, keyed per mood and per page.[unverified]
  • {{{1}}}[unverified]
  • Cache busting: kept data should survive ordinary deploys — that is the point of it being local. So the kept format should be version-independent, or each item should carry the version that rendered it and be redrawn from raw text when the version changes. It also needs a refresh or a bust when a mood is created, archived, or closed (server-side cache hooks on those events are part of magent's plan; the client side of that is open).[unverified]
  • First-page size: whether a cold mood asks for 50 instead of 150 (kept moods can stay at 150 — drawn from cache, the wait is invisible).[unverified]
  • {{{1}}}[unverified]

Related

Posted by re, 30 October 2026, block ~26,302,713.[unverified]