From 3360b34af9120e0578fdedb8748d7497ada2a635 Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Wed, 16 Jul 2025 04:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20SSR=20hydration=20mismatc?= =?UTF-8?q?h=20in=20mobile=20detection=20&=20clean=20up=20sidebar=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added a server-snapshot fallback (`() => false`) to `useIsMobile` to ensure consistent results between server-side rendering and the browser, preventing hydration mismatches. - Removed a redundant ternary in `PageLayout` sidebar styles, replacing `isMobile ? 'fixed' : 'fixed'` with a single `'fixed'` value for clarity. These changes improve SSR reliability and tidy up inline styles without affecting runtime functionality. --- web/src/components/layout/PageLayout.js | 2 +- web/src/hooks/useIsMobile.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/components/layout/PageLayout.js b/web/src/components/layout/PageLayout.js index c52e0629..044d0913 100644 --- a/web/src/components/layout/PageLayout.js +++ b/web/src/components/layout/PageLayout.js @@ -115,7 +115,7 @@ const PageLayout = () => { {showSider && ( { return () => mql.removeEventListener('change', callback); }, () => window.matchMedia(query).matches, + () => false, ); }; \ No newline at end of file