-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Conversation
…goryMap.values().find is not a function". categoryMap.values() method returns an iterator. Iterator.find() doesn't have wide browser support. It doesn't work in Firefox, Safari and others. Converting categoryMap.values() iterator to an array allow the use of find()
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +3 B (0%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
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.
The |
I see it now: Calypso polyfills only stable features ( |
@jsnajdr Thank you! So, do you think reverting and adding the polyfill would be better? |
Depends on whether we want to use experimental JS features in Calypso. Gutenberg has a conservative policy that only features that are already in a published standard can be used. But Calypso could be more liberal 🙂 I think all you need is to add the following import to import 'core-js/proposals/iterator-helpers-stage-3'; and then you can start using all the iterator helper methods like At the same time let's upgrade |
Core/Gutenberg won't use the polyfills, you're right, but I've tentatively added a PR to introduce them to Calypso. I'll follow your judgement there, and whether to merge it. It's been a while since I've Calypsoed, so to speak. |
Oh, now I see I've been commenting on a Gutenberg PR thinking I'm in the Calypso repo 🙂 Sorry if my comments were confusing! |
It's okay! ❤️ I had a bit of time to throw up a calypso PR, but I think I'll abandon it given the feedback. I'm probably not the right person to do it anyway 😄 |
What?
It's not possible to upload patterns in Firefox and Safari and other browsers that don't yet support Iterator.prototype.find().
Props to @juliacanzani for spotting this!
Why?
Uploading pattern JSON files was triggering an error in Firefox and Safari:
"categoryMap.values().find is not a function".
categoryMap.values() returns an Iterator.
Iterator.prototype.find() doesn't have wide browser support.
How?
Let's covert the
categoryMap.values()
iterator to an array to allow the use ofArray.prototype.find()
Testing Instructions
Kapture.2024-07-31.at.11.02.02.mp4