Skip to content

Commit 8ac11ce

Browse files
optionalChaining
1 parent d9ad901 commit 8ac11ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/gatsby-theme/src/components/templates/Tutorial.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Sidebar, TabletSidebar } from '../TutorialSidebar';
77
import { TutorialMdxQuery } from 'src/graphqlTypes';
88
import { HideOnTablet, ShowOnTablet } from '../../utils/responsive';
99
import { Flex, Box } from '../shared/base';
10+
import { optionalChaining } from 'src/utils/helpers';
1011

1112
type TutorialLayoutProps = { data: TutorialMdxQuery } & RouterProps;
1213

@@ -18,7 +19,7 @@ const TutorialLayout: React.FunctionComponent<TutorialLayoutProps> = ({
1819
return null;
1920
}
2021
const { pageTitle } = data!.mdx!.frontmatter!;
21-
const { tutorialTitle } = data!.tutorialTitle!.frontmatter!;
22+
const tutorialTitle = optionalChaining(() => data!.tutorialTitle!.frontmatter!.tutorialTitle!);
2223
const chapters = data!.pageTitles!.edges!.map(
2324
a => a.node!.frontmatter!.pageTitle!,
2425
);

0 commit comments

Comments
 (0)