Skip to content
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

Patterns: enable cross-browser support for pattern uploading #64123

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/edit-site/src/components/add-new-pattern/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,14 @@ export default function AddNewPattern() {
// When we're not handling template parts, we should
// add or create the proper pattern category.
if ( postType !== TEMPLATE_PART_POST_TYPE ) {
const currentCategory = categoryMap
.values()
.find( ( term ) => term.name === categoryId );
/*
* categoryMap.values() returns an iterator.
* Iterator.prototype.find() is not yet widely supported.
* Convert to array to use the Array.prototype.find method.
*/
const currentCategory = Array.from(
categoryMap.values()
).find( ( term ) => term.name === categoryId );
if ( currentCategory ) {
currentCategoryId =
currentCategory.id ||
Expand Down
Loading