Skip to content

Commit

Permalink
Merge pull request #1182 from mi6/fix/1173-preview-with-only-react-crash
Browse files Browse the repository at this point in the history
fix(root): fix website crashing when selecting react on component preview
  • Loading branch information
GCHQ-Developer-299 authored Oct 28, 2024
2 parents 1509ce5 + e332682 commit f6b461f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/CodePreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,16 @@ const ComponentPreview: React.FC<ComponentPreviewProps> = ({
type={type}
code={
getCodeSnippet(
selectedTab === "Web component" ? snippets[0] : snippets[1]
selectedTab === "Web component"
? snippets[0]
: snippets[1] ?? snippets[0]
)?.codeSnippet || ""
}
longCode={
getCodeSnippet(
selectedTab === "Web component" ? snippets[0] : snippets[1]
selectedTab === "Web component"
? snippets[0]
: snippets[1] ?? snippets[0]
)?.longCode || ""
}
show={show}
Expand All @@ -527,16 +531,18 @@ const ComponentPreview: React.FC<ComponentPreviewProps> = ({
isWebComponents={
(selectedTab === "Web component"
? snippets[0].technology
: snippets[1].technology) === "Web component"
: (snippets[1] ?? snippets[0]).technology) === "Web component"
}
projectTitle={`${
projectTitle || startCase(pageMetadata.pageTitle)
} (${
selectedTab === "Web component"
? snippets[0].technology
: snippets[1].technology
: (snippets[1] ?? snippets[0]).technology
}${getTypeOfProject(
selectedTab === "Web component" ? snippets[0] : snippets[1]
selectedTab === "Web component"
? snippets[0]
: snippets[1] ?? snippets[0]
)})`}
projectDescription={
projectDescription === undefined || projectDescription === ""
Expand Down

0 comments on commit f6b461f

Please sign in to comment.