echos-ocr/src/app
Randall Stillwell 7aedae02fc Keep card name and contact fields in sync after edits
Two bugs caused the cards list and integrations to show stale data
after a user edited a card in the detail view:

1. ResponseCard.name is a denormalized display string set only at
   OCR / survey-submit time. Editing firstName or lastName never
   recomputed it, so the table header and Name column kept the old
   value. PUT /api/cards/[id] now recomputes name from first + last
   whenever either changes (unless the caller passed an explicit
   name). The detail page header reads from in-flight edits so the
   title updates live as the user types.

2. The default form template marked only firstName/lastName as
   isCore. Every other field (email, cellPhone, address, etc.) was
   non-core, so dynamic-field edits landed in ResponseCard.fieldData
   JSON and never touched the top-level columns the list view,
   search, CSV export, and integrations read from. The PUT route
   now promotes any fieldData keys that match canonical columns up
   to those columns; the default template marks all canonical
   fields as isCore so new orgs avoid the problem in the first
   place.

Adds scripts/backfill-core-fields.ts (dry-run by default; pass
--apply to commit) to flip existing FormField rows to isCore = true
where the key matches a canonical column and to promote any
existing fieldData values into empty top-level columns + recompute
stale name values.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 08:30:27 -05:00
..
(auth) Unify invite landing with inline signup/login flow 2026-04-19 10:45:51 -05:00
(dashboard) Keep card name and contact fields in sync after edits 2026-05-21 08:30:27 -05:00
(marketing) Add in-app Contact Support dialog and Help Center docs 2026-04-24 15:10:56 -05:00
api Keep card name and contact fields in sync after edits 2026-05-21 08:30:27 -05:00
s Add dynamic fields, people directory, analytics, security hardening, and UX polish 2026-04-16 23:29:26 -05:00
favicon.ico Initial commit from Create Next App 2026-03-09 15:31:21 -05:00
globals.css Add SaaS foundation: Auth.js, dashboard shell, org model, auto-assignment 2026-04-14 23:59:38 -05:00
layout.tsx Replace hardcoded echoocr.com fallbacks with resolved site URL 2026-04-19 10:12:44 -05:00