-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor MediaPlaceholder to function component #23671
Conversation
Size Change: +971 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
0112aa4
to
15685ba
Compare
packages/block-editor/src/components/media-placeholder/index.js
Outdated
Show resolved
Hide resolved
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.
Haven't actually tested the branch yet, but the code looks good. Just some minor stylistic nitpicks.
packages/block-editor/src/components/media-placeholder/index.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/media-placeholder/index.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/media-placeholder/index.js
Outdated
Show resolved
Hide resolved
And of course, right when I post that, I notice there's a failing end-to-end test. 😆 The test seems unrelated, but the failing test does insert an Image block, so perhaps we've both overlooked something.
|
Co-authored-by: Zebulan Stanphill <zebulanstanphill@protonmail.com>
Co-authored-by: Zebulan Stanphill <zebulanstanphill@protonmail.com>
Co-authored-by: Zebulan Stanphill <zebulanstanphill@protonmail.com>
Co-authored-by: Zebulan Stanphill <zebulanstanphill@protonmail.com>
Co-authored-by: Zebulan Stanphill <zebulanstanphill@protonmail.com>
772f97d
to
f81038a
Compare
@ntsekouras Hmm! So strange. I ran the tests locally. It fails, just like in CI. |
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.
Barring test failure, LGTM!
const onlyAllowsImages = () => | ||
allowedTypes?.every( | ||
( allowedType ) => | ||
allowedType === 'image' || allowedType.startsWith( 'image/' ) |
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.
String#startsWith
isn't implemented in Internet Explorer. I looked at wp-polyfill
and the static method does appear to be polyfilled in WordPress trunk as of today (r48333):
Source for locally built wp-polyfill.js
That said, I recommend testing this feature in IE.
packages/block-editor/src/components/media-placeholder/index.js
Outdated
Show resolved
Hide resolved
Regarding the failing test here, I added a Here is the Using
You can easily reproduce the failure with another If I find the root cause, I'll post an update here and it might help us understand about other failing e2e tests, that seem to fail lately. They could be related, as more and more refactors to |
Hey @ZebulanStanphill! When you find some time take look at it again, as is now blocked from your requested changes. Thanks! |
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.
Approving since the test failure seems to be unrelated to the refactor. I'm hoping the test issue can be resolved in a less case-specific way in the future, but for now I think the current workaround is acceptable.
Description
related to #22890
How has this been tested?
Screenshots
Types of changes
Checklist: