fix(17): IN-07 memoize Intl.DateTimeFormat timezone resolution

This commit is contained in:
Lucas Berger
2026-06-18 13:47:37 -04:00
parent 2317833b74
commit 11b6b36cb9
2 changed files with 10 additions and 4 deletions
+4 -3
View File
@@ -23,7 +23,7 @@
* Security: client isAdmin gate is UX only. Server 403 is the real boundary (D-03).
*/
import { useState, useRef, useEffect } from 'react';
import { useState, useRef, useEffect, useMemo } from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { CheckCircle, AlertCircle, Loader2 } from 'lucide-react';
import {
@@ -157,8 +157,9 @@ export function AdminPage() {
},
});
// Detected browser timezone (D-02)
const detectedTz = Intl.DateTimeFormat().resolvedOptions().timeZone;
// Detected browser timezone (D-02). IN-07: memoize — the resolved zone is
// stable for the session, no need to recompute every render.
const detectedTz = useMemo(() => Intl.DateTimeFormat().resolvedOptions().timeZone, []);
// Effective timezone input value: local override → stored value → ''
const storedTimezone = timezoneQuery.data?.timezone ?? '';