refactor: prefetch basic data and window visibility change event in streaming
This commit is contained in:
@@ -20,6 +20,7 @@ import UserIcon from "@/assets/icons/user.svg";
|
||||
import Menu from "./Menu";
|
||||
import MobileNavs from "./MobileNavs";
|
||||
import User from "./User";
|
||||
import StreamStatus from "@/components/StreamStatus";
|
||||
|
||||
function HomePage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -65,6 +66,7 @@ function HomePage() {
|
||||
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 (
|
||||
<>
|
||||
<StreamStatus />
|
||||
{roleChanged && <ReLoginModal />}
|
||||
{!guest && <UnreadTabTip />}
|
||||
{!guest && <Voice />}
|
||||
|
||||
@@ -17,6 +17,7 @@ import NotFoundPage from "./404";
|
||||
import InvitePrivate from "./invitePrivate";
|
||||
import LazyIt from "./lazy";
|
||||
import InviteInMobile from "./reg/InviteInMobile";
|
||||
import usePrefetchData from "@/hooks/usePrefetchData";
|
||||
|
||||
const RegBasePage = lazy(() => import("./reg"));
|
||||
const RegWithUsernamePage = lazy(() => import("./reg/RegWithUsername"));
|
||||
@@ -47,7 +48,8 @@ const PageRoutes = () => {
|
||||
}, isEqual);
|
||||
// 提前获取device token
|
||||
useDeviceToken(vapidKey);
|
||||
|
||||
// 初始化元信息
|
||||
usePrefetchData();
|
||||
// 掉线检测
|
||||
useEffect(() => {
|
||||
if (!online) {
|
||||
|
||||
Reference in New Issue
Block a user