Skip to content

Commit

Permalink
memoize RendermimeMarkdown (10% faster)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed Jan 10, 2024
1 parent 5ac20ed commit a3dba7a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/jupyter-ai/src/components/rendermime-markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ type RendermimeMarkdownProps = {
rmRegistry: IRenderMimeRegistry;
};

export function RendermimeMarkdown(
props: RendermimeMarkdownProps
): JSX.Element {
function RendermimeMarkdownBase(props: RendermimeMarkdownProps): JSX.Element {
const [renderedContent, setRenderedContent] = useState<HTMLElement | null>(
null
);
Expand Down Expand Up @@ -57,3 +55,5 @@ export function RendermimeMarkdown(
</div>
);
}

export const RendermimeMarkdown = React.memo(RendermimeMarkdownBase);

0 comments on commit a3dba7a

Please sign in to comment.