Skip to content

Commit c133283

Browse files
committed
fix(code): code hydration error
- prismjs is under the hood, it addes language and tabIndex attributes to pre tag but the ssr results doesn't have these, so hydration error occures.
1 parent b2682fe commit c133283

File tree

1 file changed

+5
-1
lines changed
  • packages/react-notion-x/src/third-party

1 file changed

+5
-1
lines changed

packages/react-notion-x/src/third-party/code.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ export function Code({
8484

8585
return (
8686
<>
87-
<pre className={cs('notion-code', className)}>
87+
<pre
88+
className={cs('notion-code', `language-${language}`, className)}
89+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
90+
tabIndex={0}
91+
>
8892
<div className='notion-code-copy'>
8993
{copyButton}
9094

0 commit comments

Comments
 (0)