Skip to content

The agent that grows with you

fix(desktop): forward pagination params through the remote session interceptor

kshitij2607dc9a8571
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 116c11bfc53..a3f6a768a71 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -10131,9 +10131,16 @@ async function interceptSessionRequestForRemote(request) {
return undefined
}
+ // Preserve every non-profile query param (limit/offset/order pagination —
+ // stripping them made getAllSessionMessages loop the same default page
+ // against paginating remote backends).
+ const passthroughParams = new URLSearchParams(searchParams)
+ passthroughParams.delete('profile')
+ const passthroughQuery = passthroughParams.toString()
+
if (profileHasRemoteOverride(profile)) {
if (method === 'GET') {
- return fetchJsonForProfile(profile, pathname)
+ return fetchJsonForProfile(profile, passthroughQuery ? `${pathname}?${passthroughQuery}` : pathname)
}
const body = request.body && typeof request.body === 'object' ? { ...request.body } : request.body
@@ -10147,8 +10154,8 @@ async function interceptSessionRequestForRemote(request) {
if (globalRemoteActive()) {
// Single global backend: keep ?profile= so it opens the right state.db.
- const sep = pathname.includes('?') ? '&' : '?'
- const path = `${pathname}${sep}profile=${encodeURIComponent(profile)}`
+ passthroughParams.set('profile', profile)
+ const path = `${pathname}?${passthroughParams.toString()}`
if (method === 'GET') {
return fetchJsonForProfile(null, path)