Skip to content

Commit

Permalink
fix(website): prevent playground formatted editor from being empty on…
Browse files Browse the repository at this point in the history
… navigation
  • Loading branch information
jtkiesel committed Oct 29, 2024
1 parent 1be1d50 commit ab694db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions website/src/components/CodeEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default function CodeEditor(
props: Readonly<{
readOnly?: boolean;
value?: string;
defaultValue?: string;
onChange?: (value: string | undefined) => void;
}>
) {
Expand All @@ -15,7 +14,6 @@ export default function CodeEditor(
return (
<div className={styles.editor}>
<Editor
defaultValue={props.defaultValue}
language="java"
options={{ readOnly: props.readOnly }}
theme={colorMode === "dark" ? "vs-dark" : "light"}
Expand Down
8 changes: 5 additions & 3 deletions website/src/pages/playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function Inner() {
}
>
{Object.values(TrailingComma).map(option => (
<option>{option}</option>
<option key={option}>{option}</option>
))}
</select>
</label>
Expand All @@ -164,8 +164,10 @@ function Inner() {
</details>
</div>
<div className={styles.editors}>
<CodeEditor defaultValue={code} onChange={setCode} />
<CodeEditor readOnly value={formattedCode} />
<CodeEditor value={code} onChange={setCode} />
{isFirstRun.current ? null : (
<CodeEditor readOnly value={formattedCode} />
)}
</div>
</div>
);
Expand Down

0 comments on commit ab694db

Please sign in to comment.