Skip to content

Improve memoization of processedMarkdownStyle on web#684

Merged
Skalakid merged 4 commits intoExpensify:mainfrom
jmusial:fix-text-selection-needs-use-memo-on-web
Jun 3, 2025
Merged

Improve memoization of processedMarkdownStyle on web#684
Skalakid merged 4 commits intoExpensify:mainfrom
jmusial:fix-text-selection-needs-use-memo-on-web

Conversation

@jmusial
Copy link
Copy Markdown
Collaborator

@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
Copy Markdown
Contributor

@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
Copy Markdown
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