-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Template Parts: Return a stable reference for the defined 'area' #53675
Template Parts: Return a stable reference for the defined 'area' #53675
Conversation
Size Change: -11 B (0%) Total Size: 1.51 MB
ℹ️ View Unchanged
|
Flaky tests detected in 1435b5e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5866208062
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
Thanks for the review, @Addison-Stavlo 🙇 |
What?
Discovered while working on #53666.
PR updates the
TemplatePartAdvancedControls
component and avoids returning new array references frommapSelect
.Note: I've also moved
htmlElementMessages
definitions outside the component to avoid recreating a map object on each render.Why?
Array operations like
filter
andmap
will return a new array on eachmapSelect
call. This can cause unnecessary rerenders.Testing Instructions
Screenshots or screencast