fix(修复错误调用React HOOK的问题):

(cherry picked from commit 03408d4d65a52a1388d9fc251c45a624ff056766)
This commit is contained in:
anime
2024-12-03 19:46:09 +08:00
parent 7726363c69
commit d500cff483
15 changed files with 30 additions and 15 deletions

View File

@@ -156,6 +156,7 @@ const LayoutPostList = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -170,7 +171,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -137,6 +137,7 @@ const LayoutPostList = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -151,7 +152,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -316,6 +316,7 @@ const LayoutSlug = props => {
? `${post?.title} | ${siteInfo?.description}`
: `${post?.title} | ${siteInfo?.title}`
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -332,7 +333,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -267,6 +267,7 @@ const LayoutSlug = props => {
siteConfig('COMMENT_WEBMENTION_ENABLE')
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -283,7 +284,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -263,6 +263,7 @@ const LayoutArchive = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -277,7 +278,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -76,6 +76,7 @@ const LayoutSlug = props => {
// 如果 是 /article/[slug] 的文章路径则进行重定向到另一个域名
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -90,7 +91,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -225,6 +225,7 @@ const LayoutSlug = props => {
const { post, lock, validPassword } = props
const { fullWidth } = useGlobal()
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -239,7 +240,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -185,6 +185,7 @@ const LayoutSlug = props => {
)
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -201,7 +202,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -152,6 +152,7 @@ const LayoutPostList = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 用js 实现将页面中的多个视频聚合为一个分集的视频
function combineVideo() {
@@ -299,7 +300,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
return () => {

View File

@@ -255,6 +255,7 @@ const LayoutPostList = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -269,7 +270,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -322,6 +322,7 @@ const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -336,7 +337,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -221,6 +221,7 @@ const LayoutArchive = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -235,7 +236,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -152,6 +152,7 @@ const LayoutPostList = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 用js 实现将页面中的多个视频聚合为一个分集的视频
function combineVideo() {
@@ -299,7 +300,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
return () => {

View File

@@ -176,6 +176,7 @@ const LayoutArchive = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -190,7 +191,7 @@ const LayoutSlug = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])

View File

@@ -267,6 +267,7 @@ const LayoutSlug = props => {
const Layout404 = props => {
const { post } = props
const router = useRouter()
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
useEffect(() => {
// 404
if (!post) {
@@ -281,7 +282,7 @@ const Layout404 = props => {
}
}
},
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
waiting404
)
}
}, [post])