fix(18): enable first-run timezone save when not explicitly set (WR-01)
- Derive isExplicit from timezoneQuery.data?.isExplicitlySet - Apply the input===stored no-op guard only when isExplicit is true - Keep pending and empty-input guards unconditional - Add unit tests (AdminPage.timezone.test.ts) verifying first-run Save is enabled when isExplicitlySet:false and input matches stored fallback value
This commit is contained in:
@@ -111,11 +111,21 @@ export function AdminPage() {
|
||||
const storedTimezone = timezoneQuery.data?.timezone ?? '';
|
||||
const effectiveTimezoneInput = timezoneInput ?? storedTimezone;
|
||||
|
||||
// Save is disabled when pending, or when input matches what's stored
|
||||
// WR-01: derive isExplicit so we only apply the no-op guard when the timezone
|
||||
// has ALREADY been explicitly saved. On first run (isExplicitlySet: false) the
|
||||
// admin must be able to confirm/save the displayed system-default — even if the
|
||||
// input value already matches the fallback string. Keep pending and empty-input
|
||||
// guards unconditional.
|
||||
const isExplicit = timezoneQuery.data?.isExplicitlySet ?? false;
|
||||
|
||||
// Save is disabled when:
|
||||
// - mutation is in-flight (pending), OR
|
||||
// - input is empty, OR
|
||||
// - the timezone IS already explicitly set AND the input is unchanged (no-op)
|
||||
const timezoneSaveDisabled =
|
||||
timezoneMutation.isPending ||
|
||||
effectiveTimezoneInput === '' ||
|
||||
effectiveTimezoneInput === storedTimezone;
|
||||
(isExplicit && effectiveTimezoneInput === storedTimezone);
|
||||
|
||||
// IANA zones list for the datalist (Intl.supportedValuesOf may not be present in all runtimes)
|
||||
const ianaZones: string[] =
|
||||
|
||||
Reference in New Issue
Block a user