-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
CreateTemplatePartModal: avoid identity warning in useSelect #67786
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Fixes the warning in the new template part / duplicate template part modal 👍
Thanks @jsnajdr 🚀
Flaky tests detected in 08773a3. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12254426886
|
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.
Thanks, @jsnajdr!
Thanks! 🙇 |
…ss#67786) Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
This patch should fix the
useSelect
warning that @mirka reports in #67702 (comment). It happens because thedefaultTemplatePartAreas
select returns a different value on every call, even though the inputs are exactly the same. That's because:[]
default empty array is a different instance every timeareas.map
call always returns a different array, even though the input and the contents of the output are always the sameI'm fixing this by extracting the
[]
defaulting and the.map
call outside theuseSelect
hook. ThedefaultTemplatePartAreas
value is processed by another.map
call, so I'm merging both into one. Computing theicon
value just-in-time when rendering.