Block Bindings: Fix 'useSelect' warnings for attribute controls#74571
Block Bindings: Fix 'useSelect' warnings for attribute controls#74571
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. |
|
Size Change: +200 B (+0.01%) Total Size: 3.1 MB
ℹ️ View Unchanged
|
|
It looks like running |
Thanks for your help @Mamaduka . As far as I remember, it is a long standing issue as the fields list can be updated at any time. There has been some discussion about it: |
|
Yeah, there are always limitations with similar optimization hacks. This got me wondering: maybe we need a better, more general selector for block types. Considering that we have to resolve similar optimizations more often than not. It might be a good idea to revisit current private selectors, how they're used and where we're "hitting the wall". |
|
Yeah, working with this code has been very frustrating in the past. There's a whole history of (ultimately failed) attempts (e.g. #65604, #67885, and #72109)). I thought that #72974 and #73579 finally managed to fix all related issues and get rid of the warning, but alas.
Yeah, makes sense (although I'm not quite sure what that would need to look like). I'm not sure this particular issue is due to how we organize private selectors; block bindings might be somewhat uniquely problematic as their API expects users to pass functions (such as |
e1d4d3c to
e655f49
Compare
I’m thinking that the stale values aren’t necessarily due to the memo, but that the results of It seems right to derive In the changes I pushed here, I tried including a string key formed from all the field keys and and source names in the return from the |
|
Flaky tests detected in e655f49. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/21378542992
|
What?
This is a follow-up to #73579.
PR refactors values returned by the
useSelecthook inBlockBindingsAttributeControlcomponent and fixes the warning. Now thecompatibleFieldsis derived outside themapSelectcallback.Testing Instructions
Screenshots or screencast