Remove requestAnimationFrame hack and use proper ESLint disable

Replaced the requestAnimationFrame workaround with an explicit ESLint
disable comment. The setState call in this effect is intentional and
valid - it's syncing component state with localStorage when switching
to the custom theme, which is a legitimate use case for effects.

This is clearer and more maintainable than hiding the intent with
requestAnimationFrame.

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2026-01-30 13:31:09 +00:00
parent 088ec1fa25
commit 7108c158f2
@@ -73,10 +73,10 @@ export const CustomTheme = () => {
storedTheme = defaultTheme;
localStorage.setItem('customThemeCss', storedTheme);
}
// Defer setState to avoid synchronous call in effect
requestAnimationFrame(() => {
setCustomTheme(storedTheme!);
});
// This setState is intentional - we're syncing component state with localStorage
// when the user switches to the custom theme. This is a valid effect pattern.
// eslint-disable-next-line react-hooks/set-state-in-effect
setCustomTheme(storedTheme);
updateStyleElement(storedTheme);
} else {
const styleElement = document.getElementById(