Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Block Bindings: Disable editing of bound block attributes in editor UI #58085
Block Bindings: Disable editing of bound block attributes in editor UI #58085
Changes from 1 commit
2f071ad
57ab9b2
445405f
af7f870
c3567a4
35c8c64
989f456
a4dc34a
3515538
41709fa
1567f17
1984749
9644946
478f861
2acf6bd
a8a6da3
30b635e
a6f5fde
7d0cb9a
e6a5a4d
7c1ca5a
4246260
5a0cee8
54c313d
aaf8652
1f34e08
895e6dd
File filter
Filter by extension
Conversations
Jump to
keyToLabel
and use just labelThere are no files selected for viewing
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.
Do we have to return an object with the
useValue
key? I see that theuseValue
key is immediately destructured in
gutenberg/packages/block-editor/src/hooks/use-bindings-attributes.js
Lines 63 to 64 in a4dc34a
and not used anywhere else.
Can we not just return
metaValue
andupdateMetaValue
directly?I see that
updateMetaValue
is not currently used so we could even skip returning it for now, right?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.
Additionally, I'm not sure if it's acceptable that
useSource()
returns adifferent object depending on the code path. Right now, we return the
{placeholder}
if it's a template and{useValue}
otherwise.Ideally, the return type should always be the same.
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.
Oh, nevermind. I see you've already updated it. 👍
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.
I used that trying to keep the "hooks syntax", but I'm fine returning just
metaValue
andupdataMetaValue
if that works and it is preferred.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.
If the main motivation was to similarity to React hooks syntax then I would argue that it's similar but not the same so might be even more confusing.
useValue
here is not a function that returns an array but simply an array.That would be my preference but I'm happy to hear other opinions 🙂
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.
I would consider this option, however, detecting and propagating changes without using a React hook requires a different strategy, likely through subscribing to property value changes.