From a2c91ebc32dba43004aba31adad2b54efcf1b34a Mon Sep 17 00:00:00 2001
From: Eric Guo <eric@cloud-mes.com>
Date: Wed, 17 Dec 2025 04:50:33 +0800
Subject: feat(desktop): Loading more session number per project by button
 (#5616)

Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
---
 packages/desktop/src/context/global-sync.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'packages/desktop/src/context/global-sync.tsx')

diff --git a/packages/desktop/src/context/global-sync.tsx b/packages/desktop/src/context/global-sync.tsx
index 7d8186a68..53b891065 100644
--- a/packages/desktop/src/context/global-sync.tsx
+++ b/packages/desktop/src/context/global-sync.tsx
@@ -99,19 +99,19 @@ export const { use: useGlobalSync, provider: GlobalSyncProvider } = createSimple
     }
 
     async function loadSessions(directory: string) {
+      const [store, setStore] = child(directory)
       globalSDK.client.session.list({ directory }).then((x) => {
         const fourHoursAgo = Date.now() - 4 * 60 * 60 * 1000
         const nonArchived = (x.data ?? [])
           .slice()
           .filter((s) => !s.time.archived)
           .sort((a, b) => a.id.localeCompare(b.id))
-        // Include at least 5 sessions, plus any updated in the last hour
+        // Include sessions up to the limit, plus any updated in the last hour
         const sessions = nonArchived.filter((s, i) => {
-          if (i < 5) return true
+          if (i < store.limit) return true
           const updated = new Date(s.time.updated).getTime()
           return updated > fourHoursAgo
         })
-        const [, setStore] = child(directory)
         setStore("session", sessions)
       })
     }
-- 
cgit v1.2.3

