From cb9a15339df7f1bd050da703cb50e9449df5b280 Mon Sep 17 00:00:00 2001 From: taranvohra Date: Wed, 28 Aug 2024 16:05:44 +0530 Subject: [PATCH 1/2] Fix spaces list of a site --- packages/gitbook/src/app/(space)/fetch.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/gitbook/src/app/(space)/fetch.ts b/packages/gitbook/src/app/(space)/fetch.ts index 675568382..45a0d6ceb 100644 --- a/packages/gitbook/src/app/(space)/fetch.ts +++ b/packages/gitbook/src/app/(space)/fetch.ts @@ -200,18 +200,18 @@ async function fetchParentSite(args: { getSiteSpaces({ organizationId, siteId, siteShareKey }), ]); - const spaces: Record = {}; + const spaces: Array = []; siteSpaces.forEach((siteSpace) => { - spaces[siteSpace.space.id] = { + spaces.push({ ...siteSpace.space, urls: { ...siteSpace.space.urls, published: siteSpace.urls.published, }, - }; + }); }); - return { parent: site, spaces: Object.values(spaces) }; + return { parent: site, spaces }; } /** From b1de0adb6ab473dbf175a3b686c1b40d2a6a60fe Mon Sep 17 00:00:00 2001 From: taranvohra Date: Tue, 24 Sep 2024 19:17:05 +0530 Subject: [PATCH 2/2] get rid of Object.values --- packages/gitbook/src/app/(space)/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gitbook/src/app/(space)/fetch.ts b/packages/gitbook/src/app/(space)/fetch.ts index ffb515914..dcd47bd19 100644 --- a/packages/gitbook/src/app/(space)/fetch.ts +++ b/packages/gitbook/src/app/(space)/fetch.ts @@ -224,7 +224,7 @@ async function fetchParentSite(args: { return { parent, - spaces: Object.values(spaces), + spaces, }; }