Skip to content

Commit

Permalink
fix(code): code hydration error
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
nightohl committed Feb 12, 2025
1 parent b2682fe commit c133283
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react-notion-x/src/third-party/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ export function Code({

return (
<>
<pre className={cs('notion-code', className)}>
<pre
className={cs('notion-code', `language-${language}`, className)}
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
tabIndex={0}
>
<div className='notion-code-copy'>
{copyButton}

Expand Down

0 comments on commit c133283

Please sign in to comment.