fix: debug the loading problem

This commit is contained in:
Tristan Yang
2023-08-10 12:48:15 +08:00
parent 9e451b365a
commit 45e338bb16
6 changed files with 29 additions and 12 deletions
+3 -3
View File
@@ -42,16 +42,17 @@ function HomePage() {
roleChanged: store.authData.roleChanged
};
});
// preload basic data
const { success } = usePreload();
useEffect(() => {
if (isChatHomePath) {
dispatch(updateRememberedNavs({ key: "chat", path: "/chat" }));
}
}, [isChatHomePath]);
console.log("ttss", success);
console.info("preload success", success);
if (!success) {
return <Loading reload={true} fullscreen={true} />;
return <Loading reload={true} fullscreen={true} context="home-route" />;
}
const isSettingPage = pathname.startsWith("/setting");
const isChattingPage = isHomePath || pathname.startsWith("/chat");
@@ -60,7 +61,6 @@ function HomePage() {
}
// 有点绕
const chatNav = isChatHomePath ? "/chat" : chatPath || "/chat";
// console.log("navvvv", isChatHomePath, chatPath);
const userNav = userPath || "/users";
const linkClass = `flex items-center gap-2.5 px-3 py-2 font-semibold text-sm text-gray-600 rounded-lg md:hover:bg-gray-800/10`;
return (
+1 -1
View File
@@ -7,7 +7,7 @@ type Props = {
};
const Lazy: FC<Props> = ({ children }) => {
return <Suspense fallback={<Loading fullscreen={true} />}>{children}</Suspense>;
return <Suspense fallback={<Loading fullscreen={true} context="lazy" />}>{children}</Suspense>;
};
export default Lazy;