perf/refactor: SW network-only for APIs + extract estimator form primitives - #6
Conversation
The fetch handler cached every GET /api response and served it stale on failure — contradicting its own 'no offline fallback' comment and risking stale AI/regulatory responses. API is now network-only (no cache write, no stale fallback); offline fails and the app surfaces the error. Bumped the cache version to v2 so clients purge any v1 runtime cache holding old API responses. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Section/Field/TextInput/NumberInput/CheckRow were pure presentational primitives inline in estimator-form.tsx (502 lines). Moved to form-primitives.tsx; estimator-form is now 344 lines and focused on state and logic. Behavior-preserving. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughExtracts five presentational React components ( ChangesEstimator Form Primitives Extraction
Service Worker API Cache Strategy
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Continues Phase 3 (Depth & Polish) of the roadmap (
docs/plans/2026-06-17-001).Changes
/apiresponse and served it stale on failure, contradicting its own "no offline fallback" comment (the U13 "doesn't cache stale API responses" requirement). API is now network-only; cache version bumped tov2so clients purge any v1 runtime cache. The AI endpoints are POST so were never cached, but this closes the latent footgun for any GET API.Section/Field/TextInput/NumberInput/CheckRow) fromestimator-form.tsxinto a co-locatedform-primitives.tsx. The form drops 502 → 344 lines, now focused on state/logic. Behavior-preserving.Verification
tsc --noEmitclean · lint 0 errors (22 pre-existing warnings) · production build compiles successfully (covers the split + the RSC/client boundary).Finding surfaced (recommended next, NOT in this PR)
content/state-registry.ts(2860 lines) is imported directly by 17"use client"components, so the full registry ships in the client bundle. Fixing it properly (server-side data loading or per-state dynamic import) is a deliberate, higher-risk refactor across all 17 — it warrants its own focused PR with before/after bundle measurement, not a blind autonomous change. Flagging it as the highest-value remaining perf item.Still remaining in Phase 3
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Chores