Commit bd3a42e
perf: optimize code block rendering performance (#3135)
feat: optimize code block rendering performance
Memoize CodeBlock components to prevent unnecessary re-renders:
- Add MemoizedCodeContent for syntax highlighted HTML
- Add MemoizedStyledPre for container element
- Properly type all component props
- Reduce React reconciliation work for complex code blocks
Signed-off-by: Eric Wheeler <[email protected]>
Co-authored-by: Eric Wheeler <[email protected]>1 parent d27b22f commit bd3a42e
1 file changed
+42
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
608 | | - | |
| 607 | + | |
| 608 | + | |
609 | 609 | | |
610 | | - | |
611 | | - | |
| 610 | + | |
| 611 | + | |
612 | 612 | | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
617 | 616 | | |
618 | 617 | | |
619 | 618 | | |
| |||
718 | 717 | | |
719 | 718 | | |
720 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
721 | 755 | | |
0 commit comments