Skip to content

Improve memoization of processedMarkdownStyle on web #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jmusial
Copy link
Contributor

@jmusial jmusial commented May 28, 2025

Details

Use hashed memoized markdownStyles internally to avoid redundant rerenders.
It adds less code than #547

Related Issues

Closes #544.

Manual Tests

  1. Use WebExample app
  2. Remove useMemo from markdownStyle (done in the PR already)
  3. Select part of input
  4. Toggle styles
  5. Refocus input - selection stays

Videos

Before

Screen.Recording.2025-05-28.at.12.37.07.mov

After

Screen.Recording.2025-05-28.at.12.37.44.mov

Linked PRs

@jmusial jmusial marked this pull request as ready for review May 28, 2025 10:41
@jmusial jmusial changed the title fix text selection needs use memo on web Fix text selection needs use memo on web May 28, 2025
@jmusial jmusial changed the title Fix text selection needs use memo on web Fix text selection needs useMemo on web May 28, 2025
Skalakid
Skalakid previously approved these changes May 29, 2025
Copy link
Collaborator

@Skalakid Skalakid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left on code formatting comment

@tomekzaw tomekzaw changed the title Fix text selection needs useMemo on web Improve memoization of processedMarkdownStyle on web May 29, 2025
@Skalakid Skalakid merged commit 2d1a87e into Expensify:main Jun 3, 2025
5 checks passed
@os-botify
Copy link
Contributor

os-botify bot commented Jun 3, 2025

🚀 Published to npm in 0.1.281 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text selection on Web doesn't work when passing markdownStyle without useMemo
2 participants