mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-21 10:03:29 +00:00
b37797edfc
* feat(web): settle popstate-driven pane mints to one teardown/mint (TASK-2166) A held Back/Forward fires one popstate per history entry traversed, and each `?item=` change re-drives the split pane's collab provider (destroy + fresh Y.Doc/WS + op-log replay). j/k pane-follow already coalesces via PANE_FOLLOW_DEBOUNCE_MS, but popstate bypassed it entirely. Add paneMintSettle (pure, unit-tested) to settle popstate-driven `?item=` changes ~140ms before feeding ItemDetail's `ref` prop, while a deliberate open/drill/close still applies immediately. Audited the rest of PLAN-2154 Architecture D: loadUrlFilters' known-params whitelist, updateUrlFilters' `?item=`/page.state re-emit, and the `!openItemRef` title gate were already correct (TASK-2157/2158). The pane's scroll container deliberately skips the route-level persistKey/snapshot system entirely (PLAN-2105), so there's no persistKey collision to fix. Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra * fix(web): guard pane-mint settle against cross-route reuse and null refs Two Codex-review findings on the popstate settle (TASK-2166): 1. This route component is reused across a workspace/collection switch (same route id, different page.params) — wsSlug/collSlug update immediately while a coalesced ref could linger from the SOURCE workspace for up to the settle window. Gate coalescing on a same-pathname popstate only; any pathname change forces the settle module's immediate branch. 2. The `paneMintRef ?? openItemRef` fallback silently bypassed the settle whenever paneMintRef was null (pane opening from closed via a Forward burst), passing every intermediate ref straight through. Nest `<ItemDetail>`'s mount on `paneMintRef` itself (ref: string is required, so no fallback) instead of falling back to the live URL value. Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra * fix(web): never delay a pane-close settle (Codex review) A popstate landing on ref=null (the pane closing) now applies immediately instead of joining the settle window. The pane's mount boundary (`{#if openItemRef}`) already reacts to the raw URL instantly, so a delayed null left a stale non-null paneMintRef around: a quick Back-to-close-then-Forward-to-reopen within the settle window would remount ItemDetail against the pre-close ref before the real settle caught up — wrong content plus a wasted extra mint. Adds a close-then- reopen burst regression test. Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra * fix(web): close the afterNavigate-timing gap on cross-route pane mints Codex review (PR #971 round 2): afterNavigate fires AFTER SvelteKit has already committed page.params/page.url and Svelte has re-rendered the $derived tree over them (wsSlug, collSlug, ItemDetail's props). Correcting paneMintRef only from afterNavigate therefore still let one render pass through pairing the DESTINATION workspace/collection against the STALE SOURCE item ref on a workspace/collection switch (this route component is reused across such switches). Add paneMintForRoute, a $derived clamp that recomputes SYNCHRONOUSLY in the same reactive pass as page.url.pathname itself: it falls back to the live, always-route-consistent openItemRef the instant the pathname diverges from paneMintPathname (the plain var afterNavigate corrects, now just a hint rather than the sole source of truth). A same-pathname settle-in-progress — the actual pane-burst case this feature targets — is unaffected; the clamp is a pure no-op whenever the pathname hasn't changed. Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra
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
activity/ ActivityFeed
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