refactor(apollo): update apollo from 2.x.x to 3.0.1
Background
The main changes introduced in the new version of apollo are:
- a new modular package structure (installing only the @apollo/react-hooks package yields a 50% bundle size savings than using all of react-apollo.)
- the new hooks API
https://www.apollographql.com/docs/react/hooks-migration/
https://github.com/apollographql/react-apollo/blob/master/Changelog.md#breaking-changes The only breaking change that affects pubsweet is the react version. The minimum supported React version is now 16.8.
Summary
- usage of
react-apollo
package was replaced by modules available under@apollo
namespace. - updated
react
andreact-dom
dependencies to 16.9.0. The minimum supported React version for react-apollo is now 16.8. - updated
apollo-client
dependency (see issue)
How has this been tested?
Changes were tested on xpub-screening project:
- without any changes on
pubsweet-client
package regardingreact-apollo
, the usage of @apollo/react-hooks works as expected (already merged on master). In order to have this working we are still relying on the ApolloConsumer exposed by the umbrella packagereact-apollo
. - with changes brought in scope of this merge request and with NO introduction of
@apollo/react-hooks
onxpub-screening
side - with changes brought in scope of this merge request and with introduction of
@apollo/react-hooks
onxpub-screening
side (ApolloConsumer
is imported from@apollo/react-components
in this case)