Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/components/global/Playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,10 @@ export default function Playground({
version,
};

let codeBlock;
if (!hasUsageTargetOptions) {
// codeSnippets are React components, so we need to get their rendered text
// using outerText will preserve line breaks for formatting in Stackblitz editor
codeBlock = codeRef.current.querySelector('code').outerText;
} else {
codeBlock = codeRef.current.querySelector('code').outerText;
// using outerText will preserve line breaks for formatting in Stackblitz editor
let codeBlock = codeRef.current.querySelector('code').outerText;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever re-assign codeBlock, if not this can be a const.


if (hasUsageTargetOptions) {
editorOptions.files = Object.keys(codeSnippets[usageTarget])
.map((fileName) => ({
[fileName]: hostRef.current!.querySelector<HTMLElement>(`#${getCodeSnippetId(usageTarget, fileName)} code`)
Expand Down