Skip to content

Commit 63a7452

Browse files
talldanSantosGuillamot
authored andcommitted
Add comment about useSelect usage in withBlockBindingSupport (WordPress#63005)
Co-authored-by: SantosGuillamot <[email protected]> Co-authored-by: talldan <[email protected]>
1 parent 3c57dcb commit 63a7452

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/block-editor/src/hooks/use-bindings-attributes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ export const withBlockBindingSupport = createHigherOrderComponent(
109109
),
110110
[ props.attributes.metadata?.bindings, name ]
111111
);
112+
113+
// While this hook doesn't directly call any selectors, `useSelect` is
114+
// used purposely here to ensure `boundAttributes` is updated whenever
115+
// there are attribute updates.
116+
// `source.getValues` may also call a selector via `registry.select`.
112117
const boundAttributes = useSelect( () => {
113118
if ( ! bindings ) {
114119
return;

0 commit comments

Comments
 (0)