mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 09:19:51 +00:00
fix(templates): map "None" header sentinel to null before save
The header type Select uses value="none" as a sentinel (Radix disallows value=""), but the Save handler passed it through verbatim to Supabase. The DB CHECK constraint on message_templates.header_type only allows text|image|video|document, so picking "None" raised a constraint violation and the template never saved. Normalize "none" (and any falsy value) to '' at the input boundary so form.header_type is always either '' (→ null on save) or a valid type. Closes #147 (the header-dropdown half — Meta submission is tracked separately). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e828372fe3
commit
266e487ac8
@ -405,7 +405,15 @@ export function TemplateManager() {
|
||||
<Label className="text-slate-300">Header Type</Label>
|
||||
<Select
|
||||
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">
|
||||
<SelectValue placeholder="None" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user