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

Interactivity API: Fix computeds without scope in Firefox #64825

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

DAreRodz
Copy link
Contributor

What?

Replaces the internal identifier for computeds without a scope from a Symbol to an Object.

Why?

Firefox doesn't seem to accept symbols as keys for WeakMap values. It fails with the following error:

TypeError: WeakMap key Symbol() must be an object

Testing Instructions

To reproduce the issue:

  1. Checkout trunk.
  2. Add an image block on a page of your test site.
  3. Enable "Expand on click".
  4. Open Firefox and visit the page with the image.
  5. The image can't be expanded, and the error mentioned above appears in the console.

To check the issue is fixed:

  1. Checkout this PR.
  2. Follow steps 2 to 4 from the list above.
  3. The "Expand on click" feature should work fine.

@DAreRodz DAreRodz added [Type] Bug An existing feature does not function as intended [Feature] Interactivity API API to add frontend interactivity to blocks. [Packages] Interactivity /packages/interactivity labels Aug 27, 2024
@DAreRodz DAreRodz marked this pull request as ready for review August 27, 2024 12:02
@DAreRodz DAreRodz requested a review from luisherranz as a code owner August 27, 2024 12:02
@DAreRodz DAreRodz self-assigned this Aug 27, 2024
Copy link

github-actions bot commented Aug 27, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DAreRodz <[email protected]>
Co-authored-by: luisherranz <[email protected]>
Co-authored-by: Marc-pi <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@luisherranz luisherranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @DAreRodz.

Copy link

Flaky tests detected in 9ffd8e8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10577678873
📝 Reported issues:

@Marc-pi
Copy link

Marc-pi commented Aug 27, 2024

seems this PR is related to this issue #64607
i did not test it, but would be great to link them

@DAreRodz DAreRodz merged commit d0337f2 into trunk Aug 27, 2024
64 checks passed
@DAreRodz DAreRodz deleted the fix/iapi-computeds-without-scope-in-firefox branch August 27, 2024 18:05
@github-actions github-actions bot added this to the Gutenberg 19.2 milestone Aug 27, 2024
@luisherranz luisherranz added the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Aug 28, 2024
@luisherranz
Copy link
Member

I have added the label Backport to Gutenberg RC to be included in Gutenberg 19.1, which should be released today.

@Marc-pi
Copy link

Marc-pi commented Aug 28, 2024

@luisherranz / @DAreRodz did you also test that it fixes the Safari issue, as mentionned in my related issue (#64607). i'll test as soon as released, but wanted to mention it, just in case.
thx anyway

@DAreRodz
Copy link
Contributor Author

@Marc-pi, I've tested the issue with the burger menu in Safari 17.5, and it seems to be fixed. 🙂

@Marc-pi
Copy link

Marc-pi commented Aug 28, 2024

@DAreRodz thx for your confirmation ;-)

DAreRodz added a commit to DAreRodz/woocommerce that referenced this pull request Aug 28, 2024
dinhtungdu pushed a commit to woocommerce/woocommerce that referenced this pull request Aug 28, 2024
artemiomorales pushed a commit that referenced this pull request Aug 28, 2024
* Replace NO_SCOPE symbol with an object

* Update changelog

Co-authored-by: DAreRodz <[email protected]>
Co-authored-by: luisherranz <[email protected]>
Co-authored-by: Marc-pi <[email protected]>
cbravobernal added a commit that referenced this pull request Aug 28, 2024
* DataViews: Add missing styles and remove opinionated ones for generic usage (#64711)

Co-authored-by: youknowriad <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: jameskoster <[email protected]>

* Shuffle: Don't call '__experimentalGetAllowedPatterns' for every block (#64736)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: wpsoul <[email protected]>

* DataViews: hide sort direction control if there is no sortable fields (#64817)

Co-authored-by: oandregal <[email protected]>
Co-authored-by: ntsekouras <[email protected]>

* Block Bindings: Refactor utils file. (#64740)

* Refactor block binding utils

* Add security checks

Co-authored-by: cbravobernal <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: SantosGuillamot <[email protected]>
Co-authored-by: jsnajdr <[email protected]>

* Interactivity API: Fix computeds without scope in Firefox (#64825)

* Replace NO_SCOPE symbol with an object

* Update changelog

Co-authored-by: DAreRodz <[email protected]>
Co-authored-by: luisherranz <[email protected]>
Co-authored-by: Marc-pi <[email protected]>

---------

Co-authored-by: Riad Benguella <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: George Mamadashvili <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: wpsoul <[email protected]>
Co-authored-by: André <[email protected]>
Co-authored-by: oandregal <[email protected]>
Co-authored-by: Carlos Bravo <[email protected]>
Co-authored-by: cbravobernal <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: SantosGuillamot <[email protected]>
Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: David Arenas <[email protected]>
Co-authored-by: DAreRodz <[email protected]>
Co-authored-by: luisherranz <[email protected]>
Co-authored-by: Marc-pi <[email protected]>
@artemiomorales
Copy link
Contributor

artemiomorales commented Aug 28, 2024

I just cherry-picked this PR to the release/19.1 branch to get it included in the next release: #64876

@artemiomorales artemiomorales removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Aug 28, 2024
bph pushed a commit to bph/gutenberg that referenced this pull request Aug 31, 2024
…64825)

* Replace NO_SCOPE symbol with an object

* Update changelog

Co-authored-by: DAreRodz <[email protected]>
Co-authored-by: luisherranz <[email protected]>
Co-authored-by: Marc-pi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Packages] Interactivity /packages/interactivity [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants