fix(settings): save system-template color + display part role labels#275
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateTemplateSchemaso name/weekDay/startTime/endTime become optional. TheupdateTemplateservice already treatsundefinedas no-change and strips everything exceptcolorfor system templates, so no server-side change was needed.speakerLabel/readerLabelto theeditingPartstate type and populator soPartEditSheetreceives the saved values instead ofundefined.Test plan
pnpm test:unit(2212/2212 pass)pnpm test:typecheckcleanpnpm test:lintno new warnings on touched files