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

storage-rn: Incorrect interop require expressions in CJS #3250

Closed
3 tasks done
oliverdolgener opened this issue Jun 6, 2023 · 4 comments · Fixed by #3251
Closed
3 tasks done

storage-rn: Incorrect interop require expressions in CJS #3250

oliverdolgener opened this issue Jun 6, 2023 · 4 comments · Fixed by #3251

Comments

@oliverdolgener
Copy link

oliverdolgener commented Jun 6, 2023

Describe the bug

With the update to v1.0.1 the read / write operations fail. (undefined is not an object). v1.0.0 works fine.
The issue seems to come from the transpiled ts files in the dist folder. I noticed a change in the way the Async Storage is called:

v1.0.0: persistedData = await AsyncStorage__default["default"].getItem(dataKey);
v1.0.1+: persistedData = await AsyncStorage.getItem(dataKey);

For some reason Async Storage cannot be found after upgrading to v1.0.1+

Reproduction

  • install [email protected]
  • observe that the offline cache works correctly (read/write operations succeed, the app works offline)
  • upgrade to [email protected]
  • observe the the offline cache don't work at all (read/write operations fail, nothing gets written into Async Storage)

Urql version

urql 4.0.3

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
@oliverdolgener oliverdolgener changed the title offlineExchange :storage-rn not reading / writing to async storage anymore offlineExchange: storage-rn not reading / writing to async storage anymore Jun 6, 2023
@kitten kitten changed the title offlineExchange: storage-rn not reading / writing to async storage anymore storage-rn: Incorrect interop require expressions in CJS Jun 6, 2023
@oliverdolgener
Copy link
Author

@kitten Thanks a lot for this blazing fast fix :)

@kitten
Copy link
Member

kitten commented Jun 6, 2023

@oliverdolgener No worries! Would you like to give [email protected] and @urql/[email protected] a quick try before I issue a full release?

@oliverdolgener
Copy link
Author

@kitten unfortunately the app now crashes with undefined is not a function at urql.js line 19:
var Context = React__namespace.createContext(OBJ);

@kitten
Copy link
Member

kitten commented Jun 7, 2023

@oliverdolgener Did some more digging and 7a11714 should fix this for the react package. I think, I skipped a line in the Rollup docs and confused two of the options.

As before [email protected] and @urql/[email protected] are available for testing on npm.

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