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

graphcache: Untranspiled class property initializers break Safari <14.1 #3274

Closed
3 tasks done
mattwoodage opened this issue Jun 15, 2023 · 2 comments · Fixed by #3275
Closed
3 tasks done

graphcache: Untranspiled class property initializers break Safari <14.1 #3274

mattwoodage opened this issue Jun 15, 2023 · 2 comments · Fixed by #3275

Comments

@mattwoodage
Copy link

Describe the bug

Since switching from urql/core 3.0.3 to 4.0.10 and graphcache 5.0.1 to 6.1.1 our Next bundle no longer runs in Safari 12 or 13.

Screenshot 2023-06-14 at 17 27 57

It's due to the public field declaration use in GraphCache - specifically the lines
keyOfField=keyOfField;
and
resolveFieldByKey=this.resolve;
in class Store

I can see you changed browser support in August 2022 - and say that you support ECMA2015+ which includes Safari 12.

The addition of @babel/plugin-proposal-class-properties would correct the transpilation I believe.

Is this something you'd be happy to add please?

Using https://babeljs.io/ - compiled version of urql-exchange-graphcache.mjs - AS IS:
Screenshot 2023-06-15 at 10 28 06

Using https://babeljs.io/ - compiled version of urql-exchange-graphcache.mjs - WITH @babel/plugin-proposal-class-properties PLUGIN:

Screenshot 2023-06-15 at 10 28 27

Reproduction

https://github.com/urql-graphql/urql/blob/main/exchanges/graphcache/src/store/store.ts

Urql version

"@urql/core": "^4.0.10",
"@urql/exchange-graphcache": "^6.1.1",

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct
@kitten
Copy link
Member

kitten commented Jun 15, 2023

Hey, thanks for reporting this! 🙌
I'll make sure I get a hotfix out since this affects Safar <14.1 and is hence quite severe. I spotted the PR that regressed this but, to keep the build process simple and lean with recent changes, I put a further ESLint rule in place that should prevent regression on this.

Cheers!

@kitten kitten changed the title Support for Safari 12+ babel issue in GraphCache's store class Untranspiled class property initializers break Safari <14.1 Jun 15, 2023
@kitten kitten changed the title Untranspiled class property initializers break Safari <14.1 graphcache: Untranspiled class property initializers break Safari <14.1 Jun 15, 2023
@mattwoodage
Copy link
Author

@kitten thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants