fix(theme): persist preference before view transition#36
Conversation
📝 WalkthroughWalkthroughLe contexte de thème est refactorisé pour persister les préférences dans localStorage et amorcer une animation View Transitions lors du basculement. L'initialisation lit la préférence stockée, toggleTheme est mémorisé avec useCallback, et la transition "radial reveal" s'anime depuis le point de clic si l'API est disponible. ChangesPersistance des thèmes et animations View Transitions
Estimated code review effort🎯 3 (Modéré) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
localStoragebefore callingdocument.startViewTransition, so a crash inside WebKitGTK's View Transitions implementation no longer eats the user's choiceuseState(false)reset on every launch)Context
Issue #34: on CachyOS (Arch + KDE Plasma Wayland + NVIDIA), clicking the dark-mode toggle freezes the webview process — KWin shows the "not responding" dialog. The crash happens inside WebKitGTK's
startViewTransitioncompositor path; the JS event loop is fine.We can't reliably feature-detect which webkit2gtk builds are buggy, and gating on
navigator.userAgent.includes("linux")would kill the animation for every Linux user (Debian, Fedora, working Arch setups) as a regression to fix one bad config. Instead we keep the animation everywhere but make the crash a one-time annoyance: click → write localStorage → (possibly crash) → relaunch → dark mode applied.Test plan
Summary by CodeRabbit
Notes de version
Corrections de bugs
Améliorations