Skip to content

Commit eab554e

Browse files
TOC api call is handled for zero projectID (stoplightio#2834)
* TOC api call is handled for zero projectID * Dev portal version upgraded getTOC call condition updated --------- Co-authored-by: SB-ChetanKorde <chetan.korde@smartbear.com>
1 parent e5460c7 commit eab554e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/elements-dev-portal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/elements-dev-portal",
3-
"version": "3.0.7",
3+
"version": "3.0.8",
44
"description": "UI components for composing beautiful developer documentation.",
55
"keywords": [],
66
"sideEffects": [

packages/elements-dev-portal/src/hooks/useGetTableOfContents.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export function useGetTableOfContents({ projectId, branchSlug }: { projectId: st
1010
return useQuery(
1111
[...devPortalCacheKeys.branchTOC(projectId, branchSlug ?? ''), platformUrl, isLoggedIn],
1212
() => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }),
13-
{ enabled: projectId ? true : false },
13+
// Here projectId cHJqOjA is an encoded value of zero,
14+
// hence avoiding the graphql call for invalid project id
15+
{ enabled: projectId && projectId !== 'cHJqOjA' ? true : false },
1416
);
1517
}

0 commit comments

Comments
 (0)