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
+6 -1
View File
@@ -153,7 +153,12 @@ export function CalendarShell() {
// IANATimezone (the config's timezone type) is declared but not exported by @schedule-x/calendar,
// so derive it from useCalendarApp's config parameter rather than importing it.
type SxTimeZone = NonNullable<Parameters<typeof useCalendarApp>[0]['timezone']>;
const displayTimeZone: SxTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
// IN-07: memoize so this stable value never changes identity across renders —
// it feeds the useCalendarApp config the file works hard to keep stable.
const displayTimeZone = useMemo<SxTimeZone>(
() => Intl.DateTimeFormat().resolvedOptions().timeZone,
[],
);
// useCalendarApp — config is stable; plugins passed as second argument
const calendar = useCalendarApp(