Seven hand-built chats (/demo, the professional demos, quick-create, /try,
/my-data documents, custom bots and the guided demo) now share one
EmbeddedChat panel: chatkit's ChatThread and Composer with the microphone,
Copy/Listen, Stop, Retry on a failed turn, starters and suggested replies.
Each surface keeps its own prompt, route and persistence through a small
useChatTurns hook.
Also fixes /demo and the /my-data document chat reading the answer from the
wrong level of the jsonSuccess envelope, which showed empty answers.
Claude-Session: https://claude.ai/code/session_019MDtmuMRAXYWNkfowAXVfi
Co-authored-by: Claude <noreply@anthropic.com>
Re-enables the three React-Compiler-era rules deferred in #114
(set-state-in-effect, error-boundaries, immutability) — all now ON — and
resolves every violation with a real fix or a justified, documented exception.
error-boundaries (12 → 0, real fix):
- app/blog/[slug]/page.tsx wrapped its whole render in try/catch that only
re-threw. Removed it: notFound()/render errors now propagate to Next's
not-found.tsx / error.tsx as intended (the catch also mislogged notFound()).
immutability (5 → 0, real fix):
- The auth pages assigned window.location.href during render. Moved each
redirect into a useEffect (above the early returns for rules-of-hooks),
preserving the full-page navigation while keeping render pure.
signin, signup, forgot-password, verify-email (×2).
set-state-in-effect (13 → 0, justified inline disables):
- Every case is a legitimate effect use — external-system sync (Supabase auth,
API loads), browser-only hydration (localStorage, client-mount), or seeding
editable state from async-loaded data. Forcing them off-effect would add
complexity or risk behaviour changes to auth/data code, so each carries an
eslint-disable-next-line with a specific reason. The rule stays ON to catch
genuinely-avoidable derived-state-in-effect in future code.
Verified: eslint . (0 problems), prettier, tsc --noEmit, next build, jest 227 pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Dashboard (454→54 lines): Extract WelcomeHeader, StatsGrid,
QuickActions, RecentActivity into components/dashboard/.
DocumentChatPanel (302→103 lines): Extract chat state into
hooks/useDocumentChat.ts and message rendering into ChatMessageList.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>