Files
pad/web
xarmian 326acd29af fix(web): the item pane's save indicator counts the writes outstanding, so "Saved" never shows over a write still in flight (BUG-3044) (#1532)
* fix(web): the item pane's save indicator counts the writes outstanding, so "Saved" never shows over a write still in flight (BUG-3044)

saveStatus was one value written by whichever write reached it last. An older
write's success showed "Saved" while a newer one was in flight (or after the
newest had failed); one field's failure hid another's write; a previous save's
two-second timer fired mid-request. The pane's SSE gates read that value, so
each also admitted an incoming event while a local write was outstanding.

SaveTracker (web/src/lib/items/saveTracker.svelte.ts) counts outstanding
writes: 'saving' while any is out, 'saved' once the last settles only if the
newest-issued one succeeded, 'idle' otherwise. Starting a write clears the
old timer. A reset at load bumps an epoch, so a previous item's late settle is
ignored. saveStatus is now $derived from it, and the ten SSE-gate reads are
unchanged.

All nine save paths begin a token, record success through showSaved(saveTok),
and settle in a finally, so the returns that used to leave the status alone
(a superseded field write, a superseded content write, the collab flush's
force_refresh skip, an item switch) still count down. Without that, a count
would pin 'saving', and every SSE gate with it, until navigation. The raw
drain uses one token for the whole drain.

Identity-fence gate (lead ruling): each settle after an unfenced await is
tabled per row as an allowed commit whose reason cites the tracker's
stale-epoch test. The analysis is not taught to trust the epoch. Rows whose
coverage changed are re-signed. Every changed coverage run traces to this
diff: 25 rows, 285 token-run edits; the 20 not verbatim in it are boundary
splits of the import, the finally blocks, the removed timer declaration and
the helper body. Fixtures are migrated by the same rename. Kill table, old
fixtures on main against migrated fixtures here: 171 fixtures, 0 verdict
flips.

Claude-Session: https://claude.ai/code/session_01UcaMsmoCt8u7VpJhCNxiJJ

* docs(web): the raw drain's one save token is the truthful status, stated on its own terms (BUG-3044)

Claude-Session: https://claude.ai/code/session_01UcaMsmoCt8u7VpJhCNxiJJ
2026-09-25 02:40:34 -04:00
..
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00

Pad Web UI

SvelteKit 2 + Svelte 5 frontend for Pad, compiled to static files and embedded into the Go binary.

Development

npm install
npm run dev          # Dev server at localhost:5173 (proxies API to localhost:7777)
npm run build        # Production build to build/
npm run check        # Type checking with svelte-check

When developing, run the Go backend separately with make dev from the project root.

Building for Production

Do not build in isolation. Always use make build from the project root — this builds the web frontend, then compiles the Go binary with the build output embedded via //go:embed.

Stack

  • Svelte 5 with runes ($state, $derived, $effect)
  • SvelteKit 2 with adapter-static (SPA mode)
  • Tiptap block editor with markdown round-trip
  • svelte-dnd-action for drag-and-drop in board/list views
  • SSE for real-time updates
  • TypeScript throughout

Structure

src/
  routes/                    SvelteKit pages
    +layout.svelte           App shell (sidebar + main)
    +page.svelte             Landing/redirect
    [workspace]/
      +page.svelte           Dashboard (collections, phases, activity)
      +layout.svelte         SSE connection per workspace
      [collection]/
        +page.svelte         Collection view (board/list)
      [collection]/[item]/
        +page.svelte         Item detail + editor
      conventions/            Purpose-built conventions page
      playbooks/              Purpose-built playbooks page
      settings/               Workspace settings
  lib/
    api/client.ts            HTTP API client
    components/
      layout/                Sidebar, navigation
      editor/                Tiptap editor, raw markdown editor
      fields/                FieldEditor, relation picker
      items/                 ItemCard, ItemDetail
      collections/           BoardView, ListView
      common/                StatusBadge, badges, modals
      search/                CommandPalette
    stores/                  Svelte 5 reactive stores
      workspace.svelte.ts    Workspace state
      collections.svelte.ts  Collection + item state
      ui.svelte.ts           Sidebar, mobile state
    types/index.ts           TypeScript types and constants
  app.css                    Global styles and design tokens