fix(metadata): persist a cleared air_timezone instead of skipping it
Clearing a previously-set air timezone sent JSON null, which decodes to a nil *string that UpdateMetadata treats as "skip this column", so the old value remained. The dialog now sends "" (accepted by ValidateAirTimezone), and UpdateMetadata maps air_timezone through NULLIF so an empty value persists as SQL NULL (matching the nullable column) rather than "". Addresses PR #21 review (P2). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -185,7 +185,10 @@ export default function EditMetadataDialog({ item, open, onOpenChange }: EditMet
|
||||
data.last_air_date = form.last_air_date || null;
|
||||
if (form.air_time !== originalForm.air_time) data.air_time = form.air_time || null;
|
||||
if (form.air_timezone !== originalForm.air_timezone)
|
||||
data.air_timezone = form.air_timezone || null;
|
||||
// Send "" (not null) when cleared: the server treats null as "skip", so
|
||||
// clearing a previously-set timezone would not persist. "" is accepted by
|
||||
// validation and normalized to NULL server-side.
|
||||
data.air_timezone = form.air_timezone;
|
||||
if (form.air_date !== originalForm.air_date) data.air_date = form.air_date || null;
|
||||
if (form.status !== originalForm.status) data.status = form.status;
|
||||
if (form.rating_imdb !== originalForm.rating_imdb) data.rating_imdb = form.rating_imdb;
|
||||
|
||||
Reference in New Issue
Block a user