Skip to content

fix(settings): save system-template color + display part role labels#275

Merged
mindsers merged 2 commits into
mainfrom
fix/event-improvements
Jul 20, 2026
Merged

fix(settings): save system-template color + display part role labels#275
mindsers merged 2 commits into
mainfrom
fix/event-improvements

Conversation

@mindsers

Copy link
Copy Markdown
Contributor

Summary

  • Fix system templates (day-off, freeform) silently dropping color saves: relax updateTemplateSchema so name/weekDay/startTime/endTime become optional. The updateTemplate service already treats undefined as no-change and strips everything except color for system templates, so no server-side change was needed.
  • Fix the part edit sheet always showing empty speaker/reader label inputs: add speakerLabel / readerLabel to the editingPart state type and populator so PartEditSheet receives the saved values instead of undefined.

Test plan

  • Added schema unit tests: color-only submission accepted, full editable payload still accepted, empty name rejected, malformed time rejected
  • pnpm test:unit (2212/2212 pass)
  • pnpm test:typecheck clean
  • pnpm test:lint no new warnings on touched files
  • Manual: edit a system template's color and verify it persists after save/reload
  • Manual: edit a template part, set a speaker/reader label, save, reopen the pencil, verify the labels are shown

mindsers added 2 commits July 20, 2026 22:57
Two bugs in the template edit UI:

- On system templates (day-off, freeform) the info card only submits
  intent + color, but updateTemplateSchema required name/startTime/endTime.
  parseWithZod failed validation, the action returned 400, and the color
  save silently dropped. Relax those fields to optional — the service
  already treats undefined as no-change and strips everything except color
  on system templates.

- On the part edit sheet, the pencil-click populator did not copy
  speakerLabel/readerLabel into local state, so the inputs always rendered
  empty when reopening a part. Values were saved to the DB but never
  displayed, making save look broken. Add both fields to the state type
  and populator.
Address review findings on the schema relaxation from the prior commit:

- Branch on updateTemplate's null return in the update-template action.
  The service returns null when no writable fields are present (e.g. a
  system-template submission missing color, or an HTML-required bypass).
  Previously the action still flashed "success" and logged "Updated
  template" for those no-ops, polluting the audit trail with phantom
  writes. Log a warning instead and skip the success flash.

- Add two weekDay branch tests: the 'none' sentinel maps to explicit
  null (clear the binding) and an omitted weekDay yields undefined
  (leave unchanged). The numeric branch was already covered.

- Trim a duplicated comment in the schema test and drop a function-name
  reference in the schema comment to avoid rot on rename.
@mindsers
mindsers merged commit fec5de1 into main Jul 20, 2026
7 checks passed
@mindsers
mindsers deleted the fix/event-improvements branch July 20, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant