docs: ADR for client-side fetch exception in editor suggestion plugins #631

Open
opened 2026-05-19 23:31:19 +02:00 by marcel · 0 comments
Owner

Context

PR #629 introduced a per-keystroke client-side fetch from PersonMentionEditor.svelte to /api/persons (driven by the Tiptap suggestion plugin's items() callback — now via the dropdown's debounced onSearch). This violates the frontend/CLAUDE.md rule "no client-side API fetch — data flows from +page.server.ts via props".

The inline comment at PersonMentionEditor.svelte:140-153 argues the exception is justified for Tiptap's suggestion plugin (browser-only by design, latency-sensitive, cookie-auth via Vite/Caddy proxy works identically) and references a follow-up ADR — but no ADR is on disk yet.

Decision needed

Write an ADR formalising:

  1. Why the exception is justified — Tiptap suggestion plugins live in the browser; routing through a SvelteKit form action would round-trip through SSR for a typeahead that needs to feel instant; a +server.ts proxy is identical in cost but adds a hop.
  2. The boundary — client-side fetch is allowed ONLY for editor suggestion plugins (Tiptap, similar future libraries). All other client-side fetches remain disallowed.
  3. Auth model — relies on cookie-based auth flowing through the dev proxy and prod Caddy unchanged.
  4. What this enables (future Tiptap features: hashtag mention, document linking, etc.).
  5. What this does NOT enable (no general "fetch on load" pattern; SSR-first remains the default).

Reviewer rationale: Markus on PR #629 comment #10919, re-flagged on comment #10959.

Acceptance

  • ADR file added at docs/adr/00XX-client-side-fetch-exception-for-suggestion-plugins.md following existing ADR template.
  • Referenced from frontend/CLAUDE.md (the "no client-side API fetch" rule should cite the exception).
  • Inline comment in PersonMentionEditor.svelte:140-153 updated to link the ADR file.
## Context PR #629 introduced a per-keystroke client-side fetch from `PersonMentionEditor.svelte` to `/api/persons` (driven by the Tiptap suggestion plugin's `items()` callback — now via the dropdown's debounced `onSearch`). This violates the `frontend/CLAUDE.md` rule "no client-side API fetch — data flows from +page.server.ts via props". The inline comment at `PersonMentionEditor.svelte:140-153` argues the exception is justified for Tiptap's suggestion plugin (browser-only by design, latency-sensitive, cookie-auth via Vite/Caddy proxy works identically) and references a follow-up ADR — but no ADR is on disk yet. ## Decision needed Write an ADR formalising: 1. **Why the exception is justified** — Tiptap suggestion plugins live in the browser; routing through a SvelteKit form action would round-trip through SSR for a typeahead that needs to feel instant; a `+server.ts` proxy is identical in cost but adds a hop. 2. **The boundary** — client-side fetch is allowed ONLY for editor suggestion plugins (Tiptap, similar future libraries). All other client-side fetches remain disallowed. 3. **Auth model** — relies on cookie-based auth flowing through the dev proxy and prod Caddy unchanged. 4. **What this enables** (future Tiptap features: hashtag mention, document linking, etc.). 5. **What this does NOT enable** (no general "fetch on load" pattern; SSR-first remains the default). Reviewer rationale: Markus on PR #629 comment #10919, re-flagged on comment #10959. ## Acceptance - [ ] ADR file added at `docs/adr/00XX-client-side-fetch-exception-for-suggestion-plugins.md` following existing ADR template. - [ ] Referenced from `frontend/CLAUDE.md` (the "no client-side API fetch" rule should cite the exception). - [ ] Inline comment in `PersonMentionEditor.svelte:140-153` updated to link the ADR file.
marcel added the P3-laterdocumentation labels 2026-05-19 23:31:26 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#631