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
FontSizePicker: Use components instead of helper functions #44891
FontSizePicker: Use components instead of helper functions #44891
Changes from 1 commit
dc4b183
bbf17a3
450d63b
c50fa22
f882797
b108a6e
4cdf21c
c76c8e6
c5e4fae
6b26dc2
97e572a
1de7d4e
10bf17e
8f87273
299d680
b0314d2
c2b4da6
d6c4d65
9b9fc00
a939507
22c9ab3
8a0fc89
1673ba3
ab89dde
4032f0f
41006fc
591288b
3af78ec
bdef23a
639db98
File filter
Filter by extension
Conversations
Jump to
There 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.
Previously, the
selectedOption
was computed by matchingkey
andslug
:By matching the option's value instead, there's a risk of matching the wrong options, in cese two different options share the same value. I believe we should revert to using
slug
s insteadThere 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.
Yes it's true that we grabbed the option with
option.key === selectedOption.slug
to pass tovalue
:gutenberg/packages/components/src/font-size-picker/index.tsx
Lines 219 to 224 in d7e9b29
But drill down into where
selectedOption
came from and you'll see that it's the font size wherefontSize.size === value
:gutenberg/packages/components/src/font-size-picker/utils.ts
Line 151 in d7e9b29
This layer of indirection is now gone.
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 see, thank you for the explanation!
I still wonder if this
value
-base check is too brittle and we're going to end up in a situation like theColorPalette
one — but this definitely seems out of scope for this PR.