fix(app-page): clear lint regression from per-tile Suspense scaffolding

The useMemo introduced for the timezone-aware greeting in the W-RSC
per-tile Suspense pass listed [user?.timezone] as its dep array. React
Compiler's preserve-manual-memoization rule rejected the literal
optional-chain expression because the inferred dep is the wider 'user'
object — a less-specific source than the declared property access — so
the compiler refused to optimize the surrounding 1 400-line component
body.

Lift userTimezone into a local before the memo so the inferred dep and
the declared dep agree. No behaviour change; the memo still recomputes
only when the user's timezone string changes.
This commit is contained in:
Marc-André Bombeck committed 2026-05-21 12:17:08 +02:00
1 parent fa36817040
commit 8974e7730c
1 file changed
+3 -2
+3 -2
View File
@@ -573,9 +573,10 @@ export default function DashboardPage() {
// changes when the user's timezone changes; recomputing it every
// render churned the parts-array and walked the format ICU twice per
// render across a 1 400-line component body.
const userTimezone = user?.timezone;
const hour = useMemo(
() => (user?.timezone ? getHourForTimeZone(user.timezone) : null),
[user?.timezone],
() => (userTimezone ? getHourForTimeZone(userTimezone) : null),
[userTimezone],
);
const timeGreeting =
hour == null