Merge pull request #148 from ArnasDon/fix/template-header-none-sentinel

fix(templates): map "None" header sentinel to null before save
This commit is contained in:
Arnas Donauskas 2026-05-29 11:48:25 +02:00 committed by GitHub
commit 3b0d841533
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -405,7 +405,15 @@ export function TemplateManager() {
<Label className="text-slate-300">Header Type</Label> <Label className="text-slate-300">Header Type</Label>
<Select <Select
value={form.header_type} value={form.header_type}
onValueChange={(val) => setForm({ ...form, header_type: val || '' })} onValueChange={(val) =>
// "none" is a sentinel (the Select disallows value="")
// — normalize it back to empty string so the DB CHECK
// constraint (text|image|video|document) doesn't reject it.
setForm({
...form,
header_type: !val || val === 'none' ? '' : val,
})
}
> >
<SelectTrigger className="w-full bg-slate-800 border-slate-700 text-white"> <SelectTrigger className="w-full bg-slate-800 border-slate-700 text-white">
<SelectValue placeholder="None" /> <SelectValue placeholder="None" />