添加Suspense

This commit is contained in:
al 2024-08-05 13:37:37 +08:00
parent b25583ebdd
commit 999e0f4870
5 changed files with 6 additions and 20 deletions

View File

@ -1,6 +1,6 @@
"use client"; "use client";
import { Inter } from "next/font/google"; import { Inter } from "next/font/google";
import React, { useEffect } from "react"; import React,{Suspense} from "react";
import "./globals.css"; import "./globals.css";
import BottomNav from "../components/BottomNav"; import BottomNav from "../components/BottomNav";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
@ -97,7 +97,7 @@ export default function RootLayout({ children }) {
</head> </head>
<body className={`${inter.className} h-full`}> <body className={`${inter.className} h-full`}>
<main className={`w-full bg-deepBg h-full`}> <main className={`w-full bg-deepBg h-full`}>
{withAuth(<Provider store={store}>{children}</Provider>)} {withAuth(<Suspense><Provider store={store}>{children}</Provider></Suspense>)}
{/* <Provider store={store}>{children}</Provider> */} {/* <Provider store={store}>{children}</Provider> */}
</main> </main>
<footer className="fixed bottom-0 left-0 w-screen bg-black"> <footer className="fixed bottom-0 left-0 w-screen bg-black">

View File

@ -1,16 +0,0 @@
'use client';
import ReactPlayer from 'react-player';
export default function Player(props) {
let { asset, src, poster, blurDataURL, thumbnailTime, ...rest } = props;
let config = { file: { attributes: { poster } } };
return <ReactPlayer
url={src}
config={config}
width="100%"
height="100%"
{...rest}
/>;
}

View File

@ -85,6 +85,8 @@ export default function PostItem({
<Image <Image
className="flex-none w-8 h-8 rounded-full mr-2" className="flex-none w-8 h-8 rounded-full mr-2"
fit="cover" fit="cover"
width={"2rem"}
height={"2rem"}
src={data.streamer_ext?.avatar.images[0].urls[0]} src={data.streamer_ext?.avatar.images[0].urls[0]}
alt="" alt=""
onClick={() => router.push("/profile/" + data.mid)} onClick={() => router.push("/profile/" + data.mid)}

2
package-lock.json generated
View File

@ -19,7 +19,7 @@
"echarts": "^5.5.1", "echarts": "^5.5.1",
"html2canvas": "^1.0.0-alpha.12", "html2canvas": "^1.0.0-alpha.12",
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"next": "14.0.2", "next": "^14.0.2",
"next-video": "^1.1.3", "next-video": "^1.1.3",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"react": "^18", "react": "^18",

View File

@ -20,7 +20,7 @@
"echarts": "^5.5.1", "echarts": "^5.5.1",
"html2canvas": "^1.0.0-alpha.12", "html2canvas": "^1.0.0-alpha.12",
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"next": "14.0.2", "next": "^14.0.2",
"next-video": "^1.1.3", "next-video": "^1.1.3",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"react": "^18", "react": "^18",