Skip to content

refactor(apollo): update apollo from 2.x.x to 3.0.1

Andrei Mihăeș requested to merge apollo-migration into master

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 and react-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:

  1. without any changes on pubsweet-client package regarding react-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 package react-apollo.
  2. with changes brought in scope of this merge request and with NO introduction of @apollo/react-hooks on xpub-screening side
  3. with changes brought in scope of this merge request and with introduction of @apollo/react-hooks on xpub-screening side (ApolloConsumer is imported from @apollo/react-components in this case)
Edited by Andrei Mihăeș

Merge request reports