Skip to content
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

Fix TagMenu initial render perf #6483

Merged
merged 3 commits into from
Nov 18, 2024
Merged

Fix TagMenu initial render perf #6483

merged 3 commits into from
Nov 18, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Nov 18, 2024

It is expensive to run all these useMutation hooks and construct all this JSX, only for it to be thrown away / needed on tap.

At least it's expensive on low-end Android. (In dev mode, but it would be bad in prod too.)

Screenshot 2024-11-18 at 02 42 33

Instead, we want this:

Screenshot 2024-11-18 at 02 50 30

How? Move all the logic down to the case where the menu is actually shown.

One quirk is that useNavigation stays above because we don't use real portals on native. So the context would be wrong otherwise.

I've also fixed a place where we swallow an error message which made debugging hard.

Review sans whitespace

Test Plan

Native only change.

andr.mov
tagm.mov

@arcalinea arcalinea temporarily deployed to fix-tagmenu-perf - social-app PR #6483 November 18, 2024 03:37 — with Render Destroyed
Copy link

Old size New size Diff
8.05 MB 8.05 MB 0 B (0.00%)

@gaearon gaearon merged commit 4f0f9eb into main Nov 18, 2024
6 checks passed
@gaearon gaearon deleted the fix-tagmenu-perf branch November 18, 2024 22:05
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.

3 participants