From 2231c436cce607b8764e8744ea8c0c86b83f1c53 Mon Sep 17 00:00:00 2001 From: shadcn Date: Thu, 15 Jun 2023 16:29:05 +0400 Subject: [PATCH] fix: use reverse sort for chats --- app/actions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/actions.ts b/app/actions.ts index 94016a5..42fa1cd 100644 --- a/app/actions.ts +++ b/app/actions.ts @@ -13,7 +13,9 @@ export async function getChats(userId?: string | null) { try { const pipeline = kv.pipeline() - const chats: string[] = await kv.zrange(`user:chat:${userId}`, 0, -1) + const chats: string[] = await kv.zrange(`user:chat:${userId}`, 0, -1, { + rev: true + }) for (const chat of chats) { pipeline.hgetall(chat)