Skip to content

Commit 8b5adda

Browse files
committed
refactor platform paths
1 parent bcf59e4 commit 8b5adda

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/components/platformContent.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ export async function PlatformContent({includePath, platform, noGuides}: Props)
5252
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
5353

5454
if (guide) {
55-
let guidePath = `platform-includes/${includePath}/${guide}`;
56-
guidePath = udpatePathIfVersionedFileDoesNotExist(guidePath);
55+
const guidePath = udpatePathIfVersionedFileDoesNotExist(
56+
`platform-includes/${includePath}/${guide}`
57+
);
5758
try {
5859
doc = await getFileBySlug(guidePath);
5960
} catch (e) {
@@ -65,8 +66,9 @@ export async function PlatformContent({includePath, platform, noGuides}: Props)
6566
const rootNode = await getDocsRootNode();
6667
const guideObject = getCurrentGuide(rootNode, path);
6768

68-
let fallbackGuidePath = `platform-includes/${includePath}/${guideObject?.fallbackGuide}`;
69-
fallbackGuidePath = udpatePathIfVersionedFileDoesNotExist(fallbackGuidePath);
69+
const fallbackGuidePath = udpatePathIfVersionedFileDoesNotExist(
70+
`platform-includes/${includePath}/${guideObject?.fallbackGuide}`
71+
);
7072

7173
if (guideObject?.fallbackGuide) {
7274
try {
@@ -79,8 +81,9 @@ export async function PlatformContent({includePath, platform, noGuides}: Props)
7981

8082
if (!doc) {
8183
try {
82-
let platformPath = `platform-includes/${includePath}/${platform}`;
83-
platformPath = udpatePathIfVersionedFileDoesNotExist(platformPath);
84+
const platformPath = udpatePathIfVersionedFileDoesNotExist(
85+
`platform-includes/${includePath}/${platform}`
86+
);
8487

8588
doc = await getFileBySlug(platformPath);
8689
} catch (e) {
@@ -92,8 +95,9 @@ export async function PlatformContent({includePath, platform, noGuides}: Props)
9295
const rootNode = await getDocsRootNode();
9396
const platformObject = getPlatform(rootNode, platform);
9497

95-
let fallbackPlatformPath = `platform-includes/${includePath}/${platformObject?.fallbackPlatform}`;
96-
fallbackPlatformPath = udpatePathIfVersionedFileDoesNotExist(fallbackPlatformPath);
98+
const fallbackPlatformPath = udpatePathIfVersionedFileDoesNotExist(
99+
`platform-includes/${includePath}/${platformObject?.fallbackPlatform}`
100+
);
97101

98102
if (platformObject?.fallbackPlatform) {
99103
try {

0 commit comments

Comments
 (0)