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

"TypeError: root is not an Object" in react-native@0.59 #65

Closed
hkaju opened this issue Jul 19, 2019 · 6 comments
Closed

"TypeError: root is not an Object" in react-native@0.59 #65

hkaju opened this issue Jul 19, 2019 · 6 comments

Comments

@hkaju
Copy link

hkaju commented Jul 19, 2019

We're trying to use react-async in a React Native project and getting an immediate red screen with TypeError: root is not an Object. This gets thrown from https://github.com/ghengeveld/react-async/blob/a1aa8231ad631b6edc98a73f2a9abdec8ed70681/packages/react-async/src/useAsync.js#L54

We've traced the issue back to https://github.com/ghengeveld/react-async/blob/a1aa8231ad631b6edc98a73f2a9abdec8ed70681/packages/react-async/src/useAsync.js#L7 that does not resolve to global for some reason. If I remove the circular reference check global.global === global the error goes away but I don't know if that's quite correct.

Looks like this was introduced in c5a4e09

@hkaju
Copy link
Author

hkaju commented Jul 19, 2019

Downgrade to 7.0.1 gets rid of the error too.

@ghengeveld
Copy link
Member

Clearly, what fixed an issue in Node.js has broken it in React Native. This will require some work to get it right. Do you know how React Native usually deals with globals?

@ghengeveld
Copy link
Member

ghengeveld commented Jul 20, 2019

React Native apparently defines global.GLOBAL in all caps. I think omitting the check is fine, but a nicer way would be to add the all caps alternative to the condition.

@ghengeveld
Copy link
Member

Fixed in v7.0.5.

@novemberborn
Copy link

@ghengeveld I don't see 7.0.5 on npm: https://www.npmjs.com/package/react-async

@ghengeveld
Copy link
Member

Thanks for letting me know! Forgot to do the actual npm publish. It's there now 👍

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

No branches or pull requests

3 participants