notes and lists
pockist docs context.md
30 kB · 375 lines
Markdown
at main

Pockist — Agent Quick Context #

Pockist is a local-first progressive web app (PWA) for todos and notes.

  • Live URL: https://pockist.com
  • Stack: Vanilla JS (frontend) + Go 1.25 + SQLite (backend)
  • Deployment: Docker on an Ubuntu VPS
  • Philosophy: Minimal dependencies. Vanilla everything. No build step for JS.

What It Does #

  • Local-first todo lists and notes (all data stays on the user's device)
  • No accounts, no tracking
  • Temporary anonymous share links (backed by server-side SQLite)
  • Weather widget + geocoding
  • Archive / restore / search / drag-and-drop reordering
  • Import / export JSON backups

Architecture #

Layer What It Is
Frontend Single-page vanilla JS app. Web Components via custom elements. Custom event bus + event delegation.
Data Store Browser IndexedDB with a single items object store. Notes, lists, and todos are all item records with a type field.
Backend Go net/http mux. Serves static files and a handful of API endpoints.
Database SQLite for share links only. Frontend data never touches the server.
Caching Service Worker (sw.js) + in-memory Go cache (pkg/cache) for API responses.

Directory Structure #

├── main.go                    # Go server entrypoint (routes, middleware, startup)
├── handlers/                  # Go HTTP handlers
│   ├── ShareHandler.go        # Create / read / delete share links (live)
│   ├── AccountHandlers.go     # Auth handlers (dead code — not wired in main.go)
│   ├── weather_handler.go     # Weather API proxy + caching
│   ├── geocode_handler.go     # Geocode API proxy + caching
│   └── Database.go            # SQLite init
├── pkg/cache/                 # In-memory TTL cache for Go handlers
├── token/                     # JWT creation / validation (used by dead auth code)
├── public/                    # Static frontend assets
│   ├── index.html             # Single HTML shell
│   ├── app.js                 # Boot: DB init → migrations → router → service worker
│   ├── sw.js                  # Service worker (caches static assets + API GETs)
│   ├── app.webmanifest        # PWA manifest
│   ├── components/            # Custom element components
│   │   ├── ListBase.js        # Shared list CRUD logic
│   │   ├── NoteBase.js        # Shared note CRUD logic
│   │   ├── *Page.js           # Route-level page components
│   │   └── weather/           # Weather sub-components
│   ├── services/              # Business-logic modules
│   │   ├── DBManager.js       # IndexedDB wrapper, migrations, CRUD
│   │   ├── Router.js          # Client-side router (event delegation)
│   │   ├── API.js             # Fetch wrapper for backend APIs
│   │   ├── ShareService.js    # Share link helpers
│   │   ├── ImportExportService.js
│   │   ├── DialogService.js
│   │   ├── DraggableList.js
│   │   └── WeatherService.js
│   └── styles/                # CSS files (one per feature area)
├── docs/                      # Deep-dive documentation (see below)
├── Dockerfile                 # Multi-stage build (Go + alpine)
├── docker-compose.yml         # Compose with persistent volume
└── .air.toml                  # Air live-reload config (Go only)

Key Files to Know #

File Why It Matters
public/services/DBManager.js The heart of the app. IndexedDB schema, migrations, and all CRUD.
public/app.js Boot sequence. Initializes DB, runs migrations, starts router, registers SW.
public/services/Router.js Client-side routing. Uses document-level click delegation to intercept <a> tags.
public/components/ListBase.js Shared list logic: add, reorder, complete, archive, drag-drop, clear.
public/components/NoteBase.js Shared note logic: load, sort, actions.
main.go Go server. Serves static files, API routes, and catch-all fallback to index.html.
handlers/ShareHandler.go Only live backend feature: temporary share links with rate limiting.
handlers/AccountHandlers.go Dead code. Auth is not wired up. Do not treat as active.
token/*.go JWT creation / validation — contains log.Fatalf crashes (only used by dead auth code).

Current State #

Check docs/TODO.md for the canonical task list.

At a glance (as of 2026-07-14):

  • Active bugs (max 3):
    1. _clearCompleted saves list before archiving children — orphaned items on partial failure
    2. showError() alert-modal missing from index.html — errors fall back to alert()
    3. Add coordinate validation to weather_handler.go (invalid lat/lon cached 20min)
  • Major planned refactor: v11 schema migration (move from list.items[] child refs to parentId + compound index in IndexedDB). On hold until active bugs are cleared.
  • Auth system: Entirely dead code. Consolidated to backlog pending a decision to either wire it up or delete it.
  • Recently shipped (v0.1.29): Parent list tracking for archive/restore, API.fetch error handling fix.
  • Recently fixed (2026-07-14):
    • Object URL revoke race — all downloads defer URL.revokeObjectURL() by 3 seconds.
    • Router blob URL interception — blob: clicks from ImportExportService were being hijacked by the router and killed. Added blob: to Router exclusion list.

Critical Context #

Database Version #

  • Current: 10
  • Next (planned): 11 — parentId + compound index to kill N+1 queries and retire list.items[]
  • Status: v11 is on hold until Active bug backlog is cleared.

LocalStorage Migration Flags #

Flag Migration
migrationComplete textAreaDB → pockist-db
multiNoteMigrationComplete Number IDs → string IDs
todoDBMigrationComplete TodoDB → lists
itemsMigrationComplete notes + lists → unified items (v9)
itemsArrayMigrationComplete links[] → items[] (v10)

Active Risks #

  1. N+1 reads — DBManager.getListItems() fetches children one-by-one. v11 migration is the fix.
  2. Unbounded SW cache — sw.js caches every API GET (weather, geocode, shares) with no eviction.
  3. Auth decision pending — All auth work moved to backlog. Need decision: wire up or delete.
  4. List reordering index mismatch — Fixed 2026-07-08. _archiveItem now removes child refs from listItem.items before archiving. _loadCurrentList prunes legacy orphaned refs on load.
  5. _clearCompleted orphan risk — Active bug #1. saveItem called before archiveItem loop.

Session Notes #

2026-07-08 — Legacy Code Cleanup (Quick Win) #

  • Removed 4 dead methods from DBManager.js with zero callers anywhere in the codebase:
    1. getNote(id) — unreferenced externally
    2. getLists() — unreferenced externally
    3. deleteList(listId) — unreferenced externally
    4. #itemToLegacyNote(item) — only called by getNote
  • Migration chain remains intact. All 5 migration methods and their private helpers preserved.
  • Adapter methods still referenced by ImportExportService.js (saveNote, saveList, getList, createList, #itemToLegacyList) kept in place.
  • Net reduction: ~50 lines. Zero risk.

2026-06-30 — PM Handover #

  • Took over as PM from code-author mode.
  • TODO.md read and understood. AGENT_NOTES.md created.
  • Active bugs prioritized: SearchPopover entity corruption, WeatherPage listener leak, and one critical server bug next.
  • v11 schema migration confirmed as post-bug-fix roadmap item.

2026-06-30 — SearchPopover Fix Applied #

  • Fixed #highlightText in SearchPopover.js to tokenize escaped text into HTML entities and plain-text runs before applying the highlight regex.
  • Prevents queries like amp from breaking &amp; entities.
  • Entities are matched by regex &(?:#\d+|#x[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*); and skipped during highlighting.

2026-06-30 — Router Event Delegation + Listener Leak Fix #

  • Replaced per-page a.pwa click interceptors in WeatherPage.js, AboutPage.js, ListPage.js, and HomePage.js with a single document-level event delegation handler in Router.js.
  • Router.init() now uses document.addEventListener("click", ...) with event.target.closest("a") to catch all clicks on <a> tags — static and dynamically added.
  • Filters external links (http://, tel:, mailto:, #) to avoid intercepting non-app navigation.
  • Removed dead Router imports from pages that no longer reference it directly.
  • Also resolves TODO item: "Router not intercepting dynamically added <a> tags after init".

2026-06-30 — PM Queue Maintenance #

  • Read TODO.md and AGENT_NOTES.md. Confirmed docs folder has 6 files.
  • Moved completed SearchPopover and Router fixes from Active → Recently Completed (they were already there, but still checked in Active).
  • Refilled Active queue to max 3:
    1. token/ log.Fatalf DoS vector (remains)
    2. ListBase._handleAdd rollback bug (pulled from Next Up)
    3. API.js Authorization: null header (pulled from Next Up)
  • Next Up now has 1 item: weather coordinate validation.
  • v11 schema migration remains on hold until Active bug backlog is cleared.

2026-06-30 — Auth Consolidated to Backlog #

  • User directed: move all auth stuff to backlog.
  • Removed auth items from Active: token/ log.Fatalf, API.js Authorization: null.
  • Moved auth bugs from Backlog - Bugs: AccountHandler.Register name drop, AccountHandler.Authenticate empty name.
  • Moved auth security: JWT in localStorage.
  • Consolidated all under Backlog - Auth Project (On Hold).
  • Active queue refilled with non-auth bugs:
    1. ListBase._handleAdd rollback
    2. API.fetch swallowing errors
    3. ImportExportService object URL revoke race
  • Next Up: showError() missing, _clearCompleted orphan risk, weather coordinate validation.

2026-06-30 — ListBase._handleAdd Rollback Fix Verified #

  • User fixed ListBase._handleAdd catch block: listItem.items.pop() → listItem.items.shift().
  • Symmetry restored: unshift to index 0 on add, shift from index 0 on rollback.
  • Prevents silent corruption where save failure would drop the wrong (last) item instead of the newly added (first) item.
  • File: public/components/ListBase.js, line 218.
  • Moved to Recently Completed; pulled Fix showError() alert-modal missing from Next Up into Active.

2026-06-30 — PM Task 1: API.fetch Error Swallowing (In Progress) #

  • Confirmed root cause: response.json() called unconditionally; 404/500 HTML bodies cause SyntaxError → caught → returns undefined.
  • Plan provided to user: check response.ok, parse error body, re-throw after app.showError().
  • Bonus decision: fix Authorization: null header while editing API.js.
  • Blast-radius mitigation: keep try/catch in API.js and re-throw, so app.js doesn't need immediate changes.
  • Status: Awaiting user implementation and verification.

2026-07-08 — List Reordering Fix Applied (Revised: Option A) #

  • Initial attempt (Option B): Removed child refs from listItem.items in _archiveItem, added legacy cleanup in _loadCurrentList.
  • Problem discovered: ArchivePage restore logic expects the ref to still exist in the parent list. Removing it broke restore — archived items became orphans with no way to know which list they belonged to.
  • Reverted to Option A:
    1. _archiveItem: reverted to old behavior — just calls DBManager.archiveItem(itemId), ref stays in listItem.items. Restore behavior preserved.
    2. Added _pruneArchivedRefs(listItem) helper that strips dead refs from listItem.items by checking this._linkedItems for meta.archived. Re-sequences remaining refs.
    3. Called _pruneArchivedRefs() at the start of every reorder entry point: _moveItem, _reorderItem, _moveItemToTop, _moveItemToBottom, _sortItems, _clearCompleted.
    4. Kept _loadCurrentList legacy cleanup from Option B — it prunes orphaned refs on page load anyway, so dead refs are cleaned up even if no reorder happens.
  • Problem discovered (second round): _archiveItem refreshed this._linkedItems but not this._currentListItem, so the stale listItem.items still contained the dead ref. Any operation immediately after archive (add, duplicate, action menu) read the stale array and computed wrong indices / disabled wrong buttons.
  • Fix: Added _pruneArchivedRefs(listItem) to 4 more entry points: _archiveItem (after refresh), _showItemActions, _handleAdd, _doDuplicateItem. Now _currentListItem is clean immediately after archive, no refresh needed.
  • Problem discovered (third round): After archive, stale _currentListItem was cleaned in-memory by _pruneArchivedRefs, but navigating to the list page would trigger _loadCurrentList which saves the pruned array to IndexedDB. The DB permanently lost the archived ref. Restoring from ArchivePage had nowhere to put the item back — it became an orphan.
  • Root cause of root cause: We wanted to keep refs in the list for restore (Option A), but our own pruning logic was saving those pruned arrays back to the DB. The ref was lost before restore could use it.
  • Fix (Path 2 — parent tracking):
    1. DBManager.archiveItem(id, parentListId?) — added optional parentListId parameter. Sets item.meta.parentListId before archiving. Single DB write.
    2. ListBase._archiveItem — passes listItem.id as parentListId.
    3. ListBase._clearCompleted — passes listItem.id for each archived item.
    4. ArchivePage.js restore handler — reads item.meta.parentListId, loads the parent list, re-adds the item ref (appended at end with order = items.length), saves the list, then unarchives the item.
  • Edge cases handled:
    • Parent list deleted/archived → getItem returns null → skip re-adding, item restored as standalone orphan.
    • Ref already exists in parent list (shouldn't happen, defensive) → skip duplicate.
    • Notes archived without a parent list → parentListId is undefined → skip re-adding, note restored as standalone.
  • Result: restore works correctly even if the list's items[] ref was pruned from the DB by later mutations. Items know where they came from.
  • Moved list reordering bug from Active → Recently Completed.
  • Pulled _clearCompleted orphan risk into Active (slot 1 of 3).
  • Active queue now:
    1. Fix _clearCompleted saving list before archiving items (orphaned items on failure)
    2. Fix showError() alert-modal missing
    3. Fix ImportExportService revoking object URL before download starts

2026-07-01 — API.fetch Fix Completed + List Reordering Bug Investigated #

  • User completed API.fetch error swallowing fix. Moved to Recently Completed.
  • Active queue refilled to max 3:
    1. List reordering index mismatch (investigated and detailed below)
    2. showError() alert-modal missing (pulled from Next Up)
    3. ImportExportService object URL revoke race (remains)
  • List reordering root cause identified: DBManager.archiveItem() does not remove the child's ref from listItem.items[]. DOM renders only non-archived items (_getLinkedItems() filters them). DraggableList indices are DOM-based. ListBase._reorderItem applies DOM indices directly to listItem.items, which still contains archived refs. This causes the wrong item to move. _moveItem also swaps with invisible archived refs, appearing to do nothing. ListWidget pagination compounds the mismatch because #offset is computed on the filtered array but applied to the unfiltered items[].
  • Suggested fix: In _reorderItem, resolve item IDs from _getLinkedItems() before splicing listItem.items. In _moveItem, skip archived refs when finding swap targets. Optionally prune dead archived refs on list load.
  • Next Up now has: _clearCompleted orphan risk, weather coordinate validation, ShareView 3-arg confirm.

2026-07-12 — PM Mode Handover + Active Bug Verification #

  • Role change: Switched from code-author to project manager mode per user direction.
  • Active bug verification (all 3 still present):
    1. _clearCompleted orphan risk: ListBase.js:371 still calls DBManager.saveItem(listItem) (removing refs) BEFORE the archiveItem loop. If archive fails partway, items become orphaned.
    2. showError() alert-modal missing: index.html has no <dialog id="alert-modal"> element. app.js:215 always falls back to alert() + console.error. The modal shell exists in some pages but not the main index.html shell.
    3. ImportExportService object URL revoke race: #downloadJSON at line 1354 calls URL.revokeObjectURL(url) immediately after a.click(). Mobile browsers may not start the download before the URL is revoked.
  • Recent commits reviewed: b55282e implemented parent list tracking (Path 2) — archiveItem() now stores meta.parentListId, and ArchivePage.js restore re-adds items to parent lists. 8945073 bumped version to 0.1.29 and updated changelog.
  • Codebase scan: No new critical issues. Minor notes:
    • console.log/console.error statements throughout frontend (tech debt, not urgent)
    • log.Fatalf in token/ and main.go remain (already in Auth backlog)
    • public/sw.js unbounded cache still unaddressed (backlog)
  • v11 schema migration: Still on hold. Parent list tracking is a transitional v10 fix that will be superseded by item.parentId in v11.

2026-07-14 — Object URL Revoke Race Fix Applied #

  • User report: Markdown download stopped working after v0.1.29 release.
  • Root cause identified: Object URL revoke race — URL.revokeObjectURL(url) was called immediately after a.click() in all download paths. Mobile/slower browsers failed to start the download before the blob URL was destroyed.
  • Fix applied (Option A): Replaced immediate URL.revokeObjectURL(url) with setTimeout(() => URL.revokeObjectURL(url), 3000) in 4 locations:
    1. ImportExportService.exportMarkdown() — local note/list markdown export
    2. ImportExportService.exportMarkdownFromData() — shared note/list markdown export
    3. ImportExportService.#downloadJSON() — full backup & item JSON export
    4. ShareView.#downloadJSON() — share page direct JSON download
  • Active queue updated: Moved object URL race from Active #3 → Recently Completed. Pulled weather coordinate validation from Next Up into Active #3.
  • Files changed: public/services/ImportExportService.js (3 edits), public/components/ShareView.js (1 edit).

Important Conventions #

  1. Minimal dependencies. The project is intentionally vanilla. Do not introduce frameworks, bundlers, or heavy libraries without explicit user approval.
  2. Data flow: Load → mutate via DBManager → reload → re-render. Components do not hold long-lived state caches.
  3. Events: Use custom events (bubbles: true) + event delegation. Call e.stopPropagation() on native clicks to prevent double handling.
  4. Max 3 active items in TODO.md. When one is done, pull the next highest-priority item from Next Up or Backlog.
  5. Document everything:
    • Bug fixes → add a note to docs/audit-2026-06-29.md under Fixes Applied.
    • Schema / architecture changes → update the relevant deep-dive doc.
    • Decisions → append to this file under Session Notes.

Deeper Documentation #

All detailed docs live in docs/:

  • docs/TODO.md — canonical task list and roadmap
  • docs/db-and-components.md — database schema and component deep-dives
  • docs/migrations-and-compat.md — migration history and backwards compatibility rules
  • docs/dialog-service.md — DialogService API and patterns
  • docs/draggable-list.md — Drag-and-drop implementation details
  • docs/deploy_notes.md — deployment instructions
  • docs/audit-2026-06-29.md — security / code audit findings

Running Locally #

# Go backend only (no JS build step)
go run main.go
# → http://localhost:4242

# Or with Docker
docker compose up --build

The frontend is served as static files from public/. Any changes to JS/CSS/HTML are reflected immediately on refresh. Go changes require a rebuild (or use air if installed).

2026-07-14 — Router Blob URL Fix + PWA Class Review TODO #

  • User report: Markdown download still not working after object URL revoke defer fix.
  • Root cause (second round): Router event delegation (2026-06-30) intercepts all <a> clicks globally. Programmatic a.click() from ImportExportService creates an <a> with href="blob:...". The Router's filter only excluded http, tel, mailto, # — blob: passed through → event.preventDefault() → Router.go('blob:...') → "Page not found 😦" → download silently killed.
  • Fix: Added href.startsWith("blob:") to Router exclusion list (Router.js:15). Single line. Zero HTML changes. Also prevents data: URL issues in future.
  • TODO added: "Review PWA class usage" — the old per-page a.pwa click interceptors were removed in 2026-06-30. The pwa class may be dead or may be worth standardizing. Needs audit.
  • Files changed: public/services/Router.js, docs/todo.md, docs/context.md.

2026-07-14 — PM Handover + Active Bug Verification (Session 2) #

  • Role confirmed: Project Manager mode. User directed: stop writing code, manage docs/todo.md, find bugs/warnings, document changes.
  • _clearCompleted orphan risk VERIFIED FIXED: ListBase.js:371-374 now calls archiveItem loop BEFORE saveItem. If any archive fails, catch block fires, saveItem never runs, list retains original refs. Moved to Recently Completed.
  • Active bug verification (remaining 2):
    1. showError() alert-modal missing: index.html has no <dialog id="alert-modal"> element anywhere. app.js:215 always falls back to alert() + console.error. Status: Unchanged. Needs HTML template addition.
    2. Weather coordinate validation: weather_handler.go:79-88 parses lat/lon as floats but does not validate ranges (-90 to 90, -180 to 180). Invalid values like lat=999 are forwarded to Open-Meteo and the error response is cached for 20 minutes. Status: Unchanged. Needs validation.
  • Next Up verification (all 3 still present):
    1. ShareView 3-arg confirm bug: ShareView.js:239-242 passes 3 arguments to DialogService.confirm(message, confirmText, 'Stay Here'). DialogService.confirm only accepts 2 parameters. The 3rd argument 'Stay Here' is silently ignored. User sees standard Confirm/Cancel instead of intended choice. Status: Unchanged.
    2. DBManager.getDeletionToken fire-and-forget: DBManager.js:494 calls this.deleteDeletionToken(shareId) without await inside the onsuccess callback. If deletion fails, the expired token remains indefinitely. Status: Unchanged.
    3. PWA class review: The pwa class on anchor tags was used by old per-page click interceptors removed in 2026-06-30. Need to audit if any dead CSS/JS/HTML references remain, or standardize it for Router delegation. Status: Unchanged.
  • Codebase scan: No new critical issues. Notable observations:
    • console.log / console.error spam throughout frontend (~100 matches). Tech debt, not urgent.
    • CACHE_NAME bumped to "32" in sw.js and changelog updated in index.html (commit 28257e9). Routine deployment.
    • AGENT_NOTES.md marked as deprecated and merged into context.md — safe to ignore.
  • v11 schema migration: Remains on hold until Active bug backlog is cleared.

2026-07-23 — NoteWidget New Note Flow Simplified #

  • User request: Make new notes open straight into the detail page instead of a dialog prompt.
  • Changed: public/components/NoteWidget.js — replaced DialogService.promptTextarea flow with a direct call to _createNewNote() (inherited from NoteBase). This matches the behavior already used by NoteIndexPage.
  • Impact: Homepage "+ New Note" button now creates an empty note and navigates to /note/:id immediately, same as the full index page. No changes needed in NoteBase, NoteDetailPage, or DBManager.
  • Removed: Unused DialogService import from NoteWidget.js.
  • Docs: Marked new note, open straight to detail page as completed in TODO.md.

2026-07-14 — v11 Migration Plan Review #

  • User asked: Review relationship between recent parentListId fix and v11 parentId migration goals.
  • Findings:
    1. meta.parentListId (current workaround) is NOT the same as v11 parentId. Different placement (meta vs top-level), different scope (archive-only vs all children), and different queryability (unindexed vs compound index). The workaround is tactical; v11 is strategic. No collision.
    2. v11 WILL solve getListItems() N+1 query (Backlog - Tech Debt). Compound ['parentId', 'order'] index replaces per-child getItem() calls.
    3. v11 will NOT solve searchItems() loading entire DB into memory (Backlog - Bugs). getAllItems() + flat array scan remains. Search needs a separate fix: full-text index, pagination, or Web Worker.
  • Action: Updated docs/todo.md — clarified searchItems() backlog item to note v11 doesn't fix it. Marked getListItems() N+1 as solved-by-v11.

2026-08-09 — ATProto Integration Exploration #

  • User request: Explore integrating ATProto (Bluesky protocol) into Pockist.
  • Research: Read ATProto docs (lexicons, auth, sync, self-hosting, Go SDK indigo).
  • Findings: ATProto is a strong fit for Pockist's long-term goals:
    1. Replaces dead auth code — OAuth via existing Bluesky/DID identities. No custom accounts.
    2. Replaces "Pockist cloud" — User data syncs to their Personal Data Server (PDS), not our VPS.
    3. Replaces SQLite share links — Public ATProto records (com.pockist.share) are natively shareable without a backend.
    4. Enables social features — publish lists to Bluesky, collaborative lists, public feeds via AppView.
  • Recommended approach: Tier 2 — ATProto as sync + identity layer. Keep IndexedDB primary (offline-first), sync to PDS when online. This preserves Pockist philosophy while adding cross-device sync.
  • Custom lexicons proposed: com.pockist.note, com.pockist.list, com.pockist.item, com.pockist.settings, com.pockist.share. See docs/atproto-integration.md for full schemas.
  • Backend impact: Go backend gets simpler. Delete AccountHandlers.go, token/, SQLite user/share tables. Keep static file server, weather/geocode proxies. Optional: add lightweight AppView for public discovery.
  • Open questions: (1) Use @atproto/api SDK or hand-roll XRPC in vanilla JS? (2) OAuth callback — client-side or Go BFF? (3) What about users without Bluesky accounts? (4) Does this align with v11 schema migration?
  • Decision needed: User must confirm if ATProto is the desired direction vs. other sync options (Electric SQL, custom backend, etc.).
  • Files created: docs/atproto-integration.md
  • Files updated: docs/todo.md (added to Backlog - Features)

2026-08-05 — NoteDetailPage Archive Race Fix #

  • User report: Archiving a note from its detail page doesn't archive it — the note reappears in the index.
  • Root cause: _doArchive() called DBManager.archiveItem() which sets archived: true in the DB, then immediately called Router.go('/note'). Router removal of the page from DOM triggers disconnectedCallback(), which calls _save(). _save() spreads this._note.meta (stale — no archived: true) and overwrites the DB record. The note is archived for ~0ms then silently un-archived.
  • Fix: Added this._note.meta.archived = true in _doArchive() after archiveItem resolves. The subsequent disconnectedCallback._save() now preserves the archived state.
  • Files changed: public/components/NoteDetailPage.js
  • Audit: Checked ListDetailPage — no disconnectedCallback save pattern, so not affected. WorkoutDetailPage has disconnectedCallback but no save-on-exit pattern. Safe.
  • Workout meta.entries bug: User reported code not working after a field rename. Investigation found WorkoutPage.js save functions (_saveWorkout, _saveWorkoutEdit) wrote exercise data to meta.exercises, but render/edit functions read from meta.entries. Workouts appeared empty after creation or reload. Root cause: rename refactor updated reads but missed writes.
  • Fix: Changed both save functions to use meta: { ..., entries: exercises } and workout.meta = { ..., entries: exercises, ... }. Two one-word key changes. Existing workouts with meta.exercises will migrate to meta.entries on next edit.
  • Changelog nav link: Added "Changelog" drawer link (<a href="/about#changelog">) below About. Router updated to:
    1. Strip #hash from routePath before route matching (route.split(/[?#]/)[0])
    2. Scroll to hash target after page render via requestAnimationFrame
    3. Pass location.hash through popstate handler
  • Version bump: 0.1.30 → 0.1.31. CACHE_NAME bumped to "35". Changelog entry added: "Bug fixes and internal improvements".
  • Files changed: public/components/WorkoutPage.js, public/services/Router.js, public/index.html, public/sw.js, docs/todo.md, docs/context.md.