You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: View crashes with "workspacePages.map is not a function" when opening workspace #7757
The cause looks like a server API change that broke released desktop builds, not a bug in the current client code. It should already be fixed on main by #7756, the latest commit (4c56a68). I'm writing up the findings now.
Summary
In desktop v1.30.2 on macOS, opening or selecting any workspace crashes the center view into the error boundary with workspacePages.map is not a function. The code points to a mismatch between the tRPC API and older released clients. The page.list procedure used to return a bare array of pages. A pagination change made it return { items, nextCursor } instead. v1.30.2 still calls page.list and runs .map(...) on the result, and .map doesn't exist on that object. The call happens in the workspace header's Pages menu, which mounts on every workspace view, so every workspace crashes.
This is inferred from reading the code. I couldn't run anything, and I don't have the v1.30.2 source to confirm its exact call site.
Affected code
Server, now:packages/trpc/src/router/page/page.ts:461-483. page.list takes the legacy input (legacyListPagesSchema, packages/trpc/src/router/page/schema.ts:125-131). It walks every batch through listPageBatch and returns one flat array. The comment on that schema says why: "Released desktop, mobile and CLI builds still call it and expect every page back as a bare array."
New paginated endpoint:packages/trpc/src/router/page/page.ts:485-493. page.listPaginated returns { items, nextCursor }, built in listPageBatch (page.ts:305-314).
Current desktop client:apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspacePagesMenu/WorkspacePagesMenu.tsx:62-94. It goes through usePagesList / page.listPaginated and passes .items into selectMenuPages({ workspacePages, ... }). selectMenuPages.ts:32-42 then calls workspacePages methods on it. The older client in 1.30.2 worked the same way but received the raw page.list result.
Suspected root cause
For some period the deployed API's page.list returned the paginated { items, nextCursor } object while v1.30.2 still expected an array. The client's workspacePages value was therefore an object, and calling .map on it threw. Commit 4c56a68 (#7756, "restore page.list's bare-array contract for released clients") brought back the array response for page.list and moved the paginated form to page.listPaginated.
Open any workspace that has pages linked. The Pages menu in the header mounts and the view crashes.
A bun:test / integration check, next to packages/trpc/src/router/page/list.integration.ts, to lock in the contract:
test("page.list stays a bare array for released clients",async()=>{constresult=awaitcaller.page.list({ workspaceId });expect(Array.isArray(result)).toBe(true);constunscoped=awaitcaller.page.list();expect(Array.isArray(unscoped)).toBe(true);});
Prevent a repeat: add the array-shape test above. Treat existing procedure output shapes as frozen once a client has shipped, and add a new procedure (as listPaginated now is) instead of changing an old one.
Access list:packages/trpc/src/lib/sandbox/api-credential.ts:35 lists "page.list". Someone should check whether page.listPaginated also needs to be there so sandbox and CLI callers on the new endpoint aren't rejected.
Client, optional: have the desktop pages hooks also accept an array response when reading pages (Array.isArray(data) ? data : data?.items ?? []). A future server or client version mismatch would then leave the menu empty instead of crashing the whole view.
Activity
github-actions commentedon Sep 23, 2026
The cause looks like a server API change that broke released desktop builds, not a bug in the current client code. It should already be fixed on
mainby #7756, the latest commit (4c56a68). I'm writing up the findings now.Summary
In desktop v1.30.2 on macOS, opening or selecting any workspace crashes the center view into the error boundary with
workspacePages.map is not a function. The code points to a mismatch between the tRPC API and older released clients. Thepage.listprocedure used to return a bare array of pages. A pagination change made it return{ items, nextCursor }instead. v1.30.2 still callspage.listand runs.map(...)on the result, and.mapdoesn't exist on that object. The call happens in the workspace header's Pages menu, which mounts on every workspace view, so every workspace crashes.This is inferred from reading the code. I couldn't run anything, and I don't have the v1.30.2 source to confirm its exact call site.
Affected code
packages/trpc/src/router/page/page.ts:461-483.page.listtakes the legacy input (legacyListPagesSchema,packages/trpc/src/router/page/schema.ts:125-131). It walks every batch throughlistPageBatchand returns one flat array. The comment on that schema says why: "Released desktop, mobile and CLI builds still call it and expect every page back as a bare array."packages/trpc/src/router/page/page.ts:485-493.page.listPaginatedreturns{ items, nextCursor }, built inlistPageBatch(page.ts:305-314).apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspacePagesMenu/WorkspacePagesMenu.tsx:62-94. It goes throughusePagesList/page.listPaginatedand passes.itemsintoselectMenuPages({ workspacePages, ... }).selectMenuPages.ts:32-42then callsworkspacePagesmethods on it. The older client in 1.30.2 worked the same way but received the rawpage.listresult.Suspected root cause
For some period the deployed API's
page.listreturned the paginated{ items, nextCursor }object while v1.30.2 still expected an array. The client'sworkspacePagesvalue was therefore an object, and calling.mapon it threw. Commit4c56a68(#7756, "restore page.list's bare-array contract for released clients") brought back the array response forpage.listand moved the paginated form topage.listPaginated.Reproduction
A
bun:test/ integration check, next topackages/trpc/src/router/page/list.integration.ts, to lock in the contract:Fix direction
listPaginatednow is) instead of changing an old one.packages/trpc/src/lib/sandbox/api-credential.ts:35lists"page.list". Someone should check whetherpage.listPaginatedalso needs to be there so sandbox and CLI callers on the new endpoint aren't rejected.Array.isArray(data) ? data : data?.items ?? []). A future server or client version mismatch would then leave the menu empty instead of crashing the whole view.janss-en commentedon Sep 23, 2026
Just got the error too :(
ajays97 commentedon Sep 23, 2026
Same crash issue in v1.30.1
saddlepaddle commentedon Sep 23, 2026
This now should be fixed if you
cmd+R, apologies for the issue!