Skip to content

Commit

Permalink
fix: 修复 postIdKeys 为空时在生产环境下部署带来的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
cczywyc committed Dec 24, 2023
1 parent 40fd867 commit 2182620
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/(main)/blog/BlogPosts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export async function BlogPosts({ limit = 5 }) {
if (env.VERCEL_ENV === 'development') {
views = posts.map(() => Math.floor(Math.random() * 1000))
} else {
views = await redis.mget<number[]>(...postIdKeys)
if (postIdKeys.length > 0) {
views = await redis.mget<number[]>(...postIdKeys)
}
}

return (
Expand Down

0 comments on commit 2182620

Please sign in to comment.