feat: memoize components to prevent child re-renders#45
Conversation
This PR memoizes Markdown components to prevent re-renders in children. I'll include a video. Start as draft. Note: This fix doesn't solve `anchor` because of how `hardern-react-markdown` works.
|
@FranciscoMoretti is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Amazing work @FranciscoMoretti - I'd love to show this as a primary feature on the website. Maybe we can create a new section and have react-scan running? I'll give it a go on this PR. |
|
Example of react-scan in action streamdown-memo.mp4 |
|
The video/GIF would be the easiest way to do it. The ideal solution would be to apply
|
|
@haydenbleasel PR is conflict-free again 👌 Reverted |
…for Markdown elements - Introduced `ImageComponent` for handling images in Markdown. - Updated memoization for various Markdown elements to improve performance. - Cleaned up import statements for consistency.
- Replaced `ImageComponent` with `MemoImg` in the components export. - This change enhances memoization for image handling in Markdown.
Updated streamdown version from patch to minor and added feature to memoize components.
|
@FranciscoMoretti with another 🐐 PR 🙏 |
* chore(markdown): memoize components to prevent child re-renders This PR memoizes Markdown components to prevent re-renders in children. I'll include a video. Start as draft. Note: This fix doesn't solve `anchor` because of how `hardern-react-markdown` works. * changeset * Draft section * Revert "Draft section" This reverts commit df4c3ac. * fix: remove unused 'node' prop from MemoLi component * fix imports * feat: add ImageComponent to components export and update memoization for Markdown elements - Introduced `ImageComponent` for handling images in Markdown. - Updated memoization for various Markdown elements to improve performance. - Cleaned up import statements for consistency. * fix: update image component to use MemoImg for improved performance - Replaced `ImageComponent` with `MemoImg` in the components export. - This change enhances memoization for image handling in Markdown. * Change streamdown version and memoize components Updated streamdown version from patch to minor and added feature to memoize components. --------- Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
This PR memoizes Markdown components to prevent re-renders in children.
Note: This fix doesn't solve
anchorbecause of howhardern-react-markdownworks.Demo video
Memo.children.mp4