From dca9a03767112f5394686fcab36d8cc9f3ea9de1 Mon Sep 17 00:00:00 2001 From: Emmanuel Lucius <58217705+Emmaccen@users.noreply.github.com> Date: Wed, 19 Nov 2025 05:54:41 +0100 Subject: [PATCH] Rename variable for clarity in sidebar-history The variable name `firstChatFromPage` is misleading since at(-1) gets the last element of the array, not the first --- components/sidebar-history.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/sidebar-history.tsx b/components/sidebar-history.tsx index fa6a1518af..cc5ef607b7 100644 --- a/components/sidebar-history.tsx +++ b/components/sidebar-history.tsx @@ -88,13 +88,13 @@ export function getChatHistoryPaginationKey( return `/api/history?limit=${PAGE_SIZE}`; } - const firstChatFromPage = previousPageData.chats.at(-1); + const lastChatFromPage = previousPageData.chats.at(-1); - if (!firstChatFromPage) { + if (!lastChatFromPage) { return null; } - return `/api/history?ending_before=${firstChatFromPage.id}&limit=${PAGE_SIZE}`; + return `/api/history?ending_before=${lastChatFromPage.id}&limit=${PAGE_SIZE}`; } export function SidebarHistory({ user }: { user: User | undefined }) {