فهرست منبع

🐛 fix: SSR hydration mismatch in mobile detection & clean up sidebar style

- 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.
t0ng7u 10 ماه پیش
والد
کامیت
3360b34af9
2فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 1 1
      web/src/components/layout/PageLayout.js
  2. 1 0
      web/src/hooks/useIsMobile.js

+ 1 - 1
web/src/components/layout/PageLayout.js

@@ -115,7 +115,7 @@ const PageLayout = () => {
         {showSider && (
           <Sider
             style={{
-              position: isMobile ? 'fixed' : 'fixed',
+              position: 'fixed',
               left: 0,
               top: '64px',
               zIndex: 99,

+ 1 - 0
web/src/hooks/useIsMobile.js

@@ -11,5 +11,6 @@ export const useIsMobile = () => {
       return () => mql.removeEventListener('change', callback);
     },
     () => window.matchMedia(query).matches,
+    () => false,
   );
 };