awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
917 stars 265 forks source link

React 17 compatability #693

Closed revmischa closed 2 years ago

revmischa commented 2 years ago

Do you want to request a feature or report a bug?

A bug. aws-appsync-react explicitly does not work with React 17.

Also I am still mystified as to what aws-appsync-react is and whether or not I need it. Is there any documentation about what it does or if I need it for my project?

I would submit a PR to allow React 17 but I can't find the source of it. The npm package points to this repo. Maybe I'm retarded but I don't understand where this package's source is.

What is the current behavior?

➜  npm i -w foobar aws-appsync-react 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: foobar@0.5.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from foobar@0.5.0
npm ERR!   packages/fe/foobar
npm ERR!     foobar@0.5.0
npm ERR!     node_modules/foobar
npm ERR!       workspace packages/fe/foobar from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"0.14.x || 15.* || ^15.0.0 || ^16.0.0" from aws-appsync-react@4.0.10
npm ERR! node_modules/aws-appsync-react
npm ERR!   aws-appsync-react@"*" from foobar@0.5.0
npm ERR!   packages/fe/foobar
npm ERR!     foobar@0.5.0
npm ERR!     node_modules/foobar
npm ERR!       workspace packages/foobar from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
david-mcafee commented 2 years ago

Hi @revmischa! Thanks for filing this ticket.

Regarding whether or not you need aws-appsync-react - if you are using Apollo V2, you can use this package's Rehydrated component, as documented here: https://github.com/awslabs/aws-mobile-appsync-sdk-js#creating-a-client-apollo-v2. However, this is not supported with Apollo V3. This package also includes the graphqlMutation helper function, as documented here: https://github.com/awslabs/aws-mobile-appsync-sdk-js#mutations--optimistic-ui-with-graphqlmutation-helper

The primary branch of this package includes the packages that we publish for Apollo V3 support. Our apolloV2 branch contains the source code for the React package you are asking about: https://github.com/awslabs/aws-mobile-appsync-sdk-js/tree/apollov2/packages/aws-appsync-react

Regarding support for React 17, I'll need to get back to you on that. Hope this helps!

revmischa commented 2 years ago

Thanks!