Break up App.tsx
Moved from MVP Backlog 2026-10-16: the monolith is workable through MVP — the marginal cost of each edit is constant (read the relevant slice, not the whole file), and UI polish + the demo video will keep reshaping the components. Refactor after the video freezes the surface. Reassess if App.tsx passes ~4000 lines or frontend tasks become dreaded. Natural trigger to actually do it: the first post-MVP frontend feature (:button list rows, captions, column filters all touch the same cell renderers).
Shape as of 2026-10-16: 3201 lines of the 4003-line frontend; the module-level layer is 744 lines of helpers and subcomponents, and App() itself spans line 745 to end (~2450 lines in one component). Siblings for scale: urlState.ts 280, api.ts 217, StarRating.tsx 182, CheckboxList.tsx 114.
Phase 1 — mechanical extraction (lines 1–744, props only, near-zero risk): applyCssVariables / PAGE_SIZE / formatNumber / cellText / basename / fileUrl to a lib module; ImagePreview / ImageModal / ThumbnailGrid to components/images.tsx; renderCellValue / renderFormField / renderReadOnlyField + WIDGET_VOCABULARY to components/cells.tsx. tsc must stay green; npm run build before eyeballing anything (no dev server).
Phase 2 — component extraction from App() (medium): Header (view switcher), TypeTabs, ListView (table + inline edit + pagination + filter chips), EditForm (add/edit, two-phase file upload, handleAction + pendingActions + status polling), SettingsView / AdminView (roles). State stays lifted in App and passed via props (at most one context if drilling hurts) — no state library, no router; the minimalism rule outlives MVP.
Phase 3 — only if needed: carve the state clusters (view mode, scoping, search, pagination, form state). The urlState writer effect must keep mirroring the main fetch effect's deps exactly — that coupling is the hardest single seam in the file.
Traps from nearby items, all binding on the split:
handleActionis coupled to the open edit form (editRecord,formDef, password gate, re-open on failure); the list-form button item deliberately writes a sibling instead of reusing it. Keep that split when extracting.submitFormhas two payload paths (add / update), both filteringformValuestoformDefkeys withhasOwnProperty, notin(the[]JSON-NULL echo bug). Preserve on both paths.- The frontend stays schema-driven — no hard-coded field lists ride along into extracted components.
- Slot
- 16600
- Status
- 10 Open
- Tags
- frontend, maintenance
- Contributors
- Donnie