Tweak data fetching with suspense
This commit is contained in:
parent
f18e90289d
commit
d087b429ee
5 changed files with 68 additions and 41 deletions
|
|
@ -5,7 +5,11 @@ import { kv } from '@vercel/kv'
|
|||
|
||||
import { type Chat } from '@/lib/types'
|
||||
|
||||
export async function getChats(userId: string) {
|
||||
export async function getChats(userId?: string | null) {
|
||||
if (!userId) {
|
||||
return []
|
||||
}
|
||||
|
||||
try {
|
||||
const pipeline = kv.pipeline()
|
||||
const chats: string[] = await kv.zrange(`user:chat:${userId}`, 0, -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue