From 54536d4e794d76bbbd1c4091f157a426e9333fa1 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Thu, 6 Aug 2026 17:50:22 +0800 Subject: [PATCH] update --- src/app/(main)/axios/AxiosProvider.tsx | 13 ++++++++++--- src/app/global.css | 6 ++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/(main)/axios/AxiosProvider.tsx b/src/app/(main)/axios/AxiosProvider.tsx index e2f5f2f..6b9fcb5 100644 --- a/src/app/(main)/axios/AxiosProvider.tsx +++ b/src/app/(main)/axios/AxiosProvider.tsx @@ -19,9 +19,13 @@ const TokenContext = createContext<{ setAccessToken: () => {}, }); +/** True after client hydrate and accessToken is available (safe to call authed APIs). */ +const AuthReadyContext = createContext(false); + export const AxiosProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { const [accessToken, setAccessToken] = useState(null); const [isHydrated, setIsHydrated] = useState(false); + const isAuthReady = isHydrated && Boolean(accessToken); // Hydrate token only on client useEffect(() => { @@ -103,12 +107,15 @@ export const AxiosProvider: React.FC<{ children: React.ReactNode }> = ({ childre return ( - {/* Render children immediately – they will just not have the token for 1-2ms */} - {children} + + {/* Render children immediately – they will just not have the token for 1-2ms */} + {children} + ); }; export const useAxios = () => useContext(AxiosContext); -export const useToken = () => useContext(TokenContext); \ No newline at end of file +export const useToken = () => useContext(TokenContext); +export const useAuthReady = () => useContext(AuthReadyContext); \ No newline at end of file diff --git a/src/app/global.css b/src/app/global.css index 61f2c22..d7561e8 100644 --- a/src/app/global.css +++ b/src/app/global.css @@ -41,8 +41,10 @@ html:has([data-po-workbench-layout]) body { /* Tablet/mobile: stable layout when virtual keyboard opens */ html { - /* Prefer dynamic viewport height so layout can adapt to keyboard (if browser resizes) */ - height: 100%; + /* min-height (not height) so the document can grow with content; + fixed height: 100% locked the box to the viewport and exposed white below long pages. */ + min-height: 100%; + min-height: 100dvh; /* Base font size: slightly larger for readability */ font-size: 16px; }