Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Support React 16 #760

Closed
jpshelley opened this issue Jun 6, 2017 · 14 comments
Closed

Support React 16 #760

jpshelley opened this issue Jun 6, 2017 · 14 comments

Comments

@jpshelley
Copy link

jpshelley commented Jun 6, 2017

Steps to Reproduce

It seems apollo will need to support React 16 sooner rather then later. React-Native under the hood is already using [email protected]

facebook/react-native#13291

See the couple of issues linked to that specific issue ^^

Yes its dumb that they depend on an alpha version. Is there anyway for Apollo to support it?
For what its worth my build currently seems to function okay minus some warnings, but jest testing support is failing due to conflicts between dependencies.

Buggy Behavior

Test suite failed to run

    TypeError: Cannot read property 'ReactCurrentOwner' of undefined
      
      at Object.<anonymous> (node_modules/react-dom/cjs/react-dom-server.development.js:5861:36)
      at Object.<anonymous> (node_modules/react-dom/server.js:6:20)
      at Object.<anonymous>.graphqlTag (node_modules/react-apollo/lib/react-apollo.umd.js:2:191)
      at Object.<anonymous> (node_modules/react-apollo/lib/react-apollo.umd.js:5:2)

Expected Behavior

Tests should pass.

Version

@zachzhao1984
Copy link

+1

@helfer
Copy link
Contributor

helfer commented Jun 14, 2017

@jpshelley @nouh we've already included react@16-alpha to peer dependencies. If there are any other changes we need to make, please send over a PR!

@viczam
Copy link

viczam commented Jun 18, 2017

Even though I have react-dom@15 included as a dependency of my project, react-dom@16 gets installed as a dependency of react-apollo, which causes rendering incompatibilities.
Is this happening because react-dom@16 is listed as an optionalDependencies?

Note: this doesn't happen for react package itself.

@helfer
Copy link
Contributor

helfer commented Jun 20, 2017

Yes, that could very well be the reason. Which version of npm are you using?

@jbaxleyiii do you remember why we moved this to an optional dependency? I feel like it had something to do with typescript types.

@viczam
Copy link

viczam commented Jun 20, 2017

I'm using yarn, haven't tried with npm.
And I believe you made that change to better support react-native.

@jpshelley
Copy link
Author

@helfer it might not be development related but only test related. My React Native app runs fine with the apollo versions listed, but my tests are failing. I know Enzyme is broken currently against React 16 so maybe thats the issue? enzymejs/enzyme#1007

@kernelgonnapanic
Copy link

I also have a problem with having react-dom@16 in optional dependencies in yarn.lock, as tests are failing due to: Cannot read property 'ReactCurrentOwner' of undefined. I've read somewhere that this kind of error is related to having two versions of react-dom in the app.
If I manually remove react-dom@16 from dependencies in yarn.lock, react-dom@15 gets installed and tests run smoothly. (I'm using all the libs in versions that use react 15).

@jcheroske
Copy link

Same issue here:

yarn list v0.27.5
├─ [email protected]
│  └─ [email protected]
└─ [email protected]

This is breaking my build.

@Danilo-Araujo-Silva
Copy link

Danilo-Araujo-Silva commented Jul 6, 2017

For me when react-apollo is doing this:

optionalDependencies:
    react-dom "0.14.x || 15.* || ^15.0.0 || ^16.0.0-alpha"

it resolves like this:

"[email protected] || 15.* || ^15.0.0 || ^16.0.0-alpha":
  version "16.0.0-alpha.13"
  resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0-alpha.13.tgz#c2b39aaf8645f1d664619fb49a1fbb9f60719c23"
  dependencies:
    fbjs "^0.8.9"
    loose-envify "^1.1.0"
    object-assign "^4.1.0"
    prop-types "^15.5.6"

But in my dependencies I have:

"dependencies": {
    "react": ">=15.5.4",
    "react-dom": ">=15.5.4"
},

which resolves with this:

react-dom@>=15.5.4:
  version "15.6.1"
  resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1.tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470"
  dependencies:
    fbjs "^0.8.9"
    loose-envify "^1.1.0"
    object-assign "^4.1.0"
    prop-types "^15.5.10"

So the versions is mismatching.

So how could we use react-apollo with the latest stable version of react, instead of alpha versions?

@WickyNilliams
Copy link

WickyNilliams commented Jul 13, 2017

Can i suggest rolling back the change to add react alpha, and adding that in a new major version, since it's clearly a breaking change. That way anyone who wants to upgrade can, while the rest of us can continue without issue

@eugene1g
Copy link

For me forcing react-dom to v15 by requiring it as "react-dom": "<15.99" resolved the conflict

@stale
Copy link

stale bot commented Aug 10, 2017

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

@stale stale bot closed this as completed Aug 24, 2017
@stale
Copy link

stale bot commented Aug 24, 2017

This issue has been automatically closed because it has not had recent activity after being marked as no recent activyt. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to React Apollo!

@MichaelDeBoey
Copy link

I don't think this should be closed 😕

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

No branches or pull requests

10 participants