🐛 fix: slove when logout always show loading (#10284)

fix: slove when logout always show loading
This commit is contained in:
Shinji-Li
2025-11-18 17:06:59 +08:00
committed by GitHub
parent 14fe7c5736
commit d91fb73f68
2 changed files with 4 additions and 40 deletions

View File

@@ -36,27 +36,9 @@ const RootLayout = (props: { locale: Locales }) => {
);
};
// Hydration gate loader - waits for client state to be ready before rendering
// Hydration gate loader -always return true to bypass hydration gate
const hydrationGateLoader: LoaderFunction = () => {
const { isAppHydrated } = useGlobalStore.getState();
// 如果状态已经就绪,直接放行
if (isAppHydrated) {
return null;
}
// 否则,返回一个 Promise"暂停" 渲染
return new Promise((resolve) => {
console.log('[HydrationGate] Waiting for client state...');
// 订阅 useGlobalStore 的变化
const unsubscribe = useGlobalStore.subscribe((state) => {
if (state.isAppHydrated) {
console.log('[HydrationGate] Client state ready. Gate opened!');
unsubscribe(); // 清理订阅
resolve(null); // Promise 完成,门卫放行
}
});
});
return true
};
// Create desktop router configuration

View File

@@ -34,27 +34,9 @@ const RootLayout = (props: { locale: Locales }) => (
</>
);
// Hydration gate loader - waits for client state to be ready before rendering
// Hydration gate loader -always return true to bypass hydration gate
const hydrationGateLoader: LoaderFunction = () => {
const { isAppHydrated } = useGlobalStore.getState();
// 如果状态已经就绪,直接放行
if (isAppHydrated) {
return null;
}
// 否则,返回一个 Promise"暂停" 渲染
return new Promise((resolve) => {
console.log('[HydrationGate] Waiting for client state...');
// 订阅 useGlobalStore 的变化
const unsubscribe = useGlobalStore.subscribe((state) => {
if (state.isAppHydrated) {
console.log('[HydrationGate] Client state ready. Gate opened!');
unsubscribe(); // 清理订阅
resolve(null); // Promise 完成,门卫放行
}
});
});
return true
};
// Create mobile router configuration