diff --git a/src/components/platformIdentifier.tsx b/src/components/platformIdentifier.tsx
index 24cd7ced8edde..ad5df1f6350ff 100644
--- a/src/components/platformIdentifier.tsx
+++ b/src/components/platformIdentifier.tsx
@@ -30,13 +30,24 @@ function formatCaseStyle(style: PlatformCaseStyle | undefined, value: string) {
export function PlatformIdentifier({name, platform}: Props) {
const {rootNode, path} = serverContext();
- let currentPlatformOrGuide = rootNode && getCurrentPlatformOrGuide(rootNode, path);
+ if (!rootNode) {
+ return null;
+ }
+
+ let currentPlatformOrGuide = getCurrentPlatformOrGuide(rootNode, path);
if (!currentPlatformOrGuide && platform) {
- currentPlatformOrGuide = rootNode && getPlatform(rootNode, platform);
+ currentPlatformOrGuide = getPlatform(rootNode, platform);
}
if (!currentPlatformOrGuide) {
return null;
}
- return {formatCaseStyle(currentPlatformOrGuide.caseStyle, name)}
;
+ // For guides, fall back to the parent platform's case style.
+ let caseStyle = currentPlatformOrGuide.caseStyle;
+ if (!caseStyle && currentPlatformOrGuide.type === 'guide') {
+ const parent = getPlatform(rootNode, currentPlatformOrGuide.platform);
+ caseStyle = parent?.caseStyle;
+ }
+
+ return {formatCaseStyle(caseStyle, name)}
;
}