From f29ccac479317b32f3784051b481a2db727b08b4 Mon Sep 17 00:00:00 2001 From: sdcb Date: Thu, 5 Dec 2024 19:06:24 +0800 Subject: [PATCH] fix load more function --- src/BE/Controllers/Chats/Chats/UserChatsController.cs | 2 +- src/FE/components/HomeContent/HomeContent.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BE/Controllers/Chats/Chats/UserChatsController.cs b/src/BE/Controllers/Chats/Chats/UserChatsController.cs index be4a5b73..8c8f9727 100644 --- a/src/BE/Controllers/Chats/Chats/UserChatsController.cs +++ b/src/BE/Controllers/Chats/Chats/UserChatsController.cs @@ -55,7 +55,7 @@ public async Task>> GetChats([FromQuery] IQueryable query = db.Chats .Include(x => x.Model) .Where(x => x.UserId == currentUser.Id && !x.IsDeleted) - .OrderByDescending(x => x.CreatedAt); + .OrderByDescending(x => x.Id); if (!string.IsNullOrWhiteSpace(request.Query)) { query = query.Where(x => x.Title.Contains(request.Query)); diff --git a/src/FE/components/HomeContent/HomeContent.tsx b/src/FE/components/HomeContent/HomeContent.tsx index 91737106..9f118b66 100644 --- a/src/FE/components/HomeContent/HomeContent.tsx +++ b/src/FE/components/HomeContent/HomeContent.tsx @@ -298,7 +298,7 @@ const HomeContent = () => { }); let chatList = rows; if (!modelList) { - chatList = rows.concat(chats); + chatList = chats.concat(rows); } dispatch({ field: 'chats', value: chatList }); if (modelList) {