Skip to content

Commit 5805c24

Browse files
authored
Fix copy for code blocks in OpenAPI or AI answers (#2250)
1 parent d0ef225 commit 5805c24

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/DocumentView/CodeBlock/PlainCodeBlock.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DocumentBlockCode, JSONDocument } from '@gitbook/api';
2+
import { useId } from 'react';
23

34
import { CodeBlock } from './CodeBlock';
45

@@ -8,8 +9,10 @@ import { CodeBlock } from './CodeBlock';
89
*/
910
export function PlainCodeBlock(props: { code: string; syntax: string }) {
1011
const { code, syntax } = props;
12+
const id = useId();
1113

1214
const block: DocumentBlockCode = {
15+
key: id,
1316
object: 'block',
1417
type: 'code',
1518
data: {

0 commit comments

Comments
 (0)