This updates to the latest version of the apollo client. This version has two breaking changes that affect SpeakEasy:
Conslidation
The apollo folks did a lot of consolidation in the 3.0 release such that all of the disparate packages (e.g. apollo-client, apollo-link-http, etc.) are now available under a singular @apollo/client. The client also includes and re-exports the graphql-tags package as well. Mostly, this just meant rewriting the imports then to meet their new structure. Given that SpeakEasy does not dive deeply into the advanced functionality of configuring the client or cache, this was rather straight-forward.
Query / Cache results are immutable
Any result coming from apollo is now immutable and cannot be changed. To alter a returned data set, we must first make a clone of it, and then alter that instead. This seems to occur currently only once in the codebase (https://github.com/SpeakEasy-tools/SpeakEasy/pull/117/files#diff-688806a53f2045d9839e5cbef46dc8e5R63-R65), and so would be something to remember going forward. On the upside, this move to immutability promises some amount of cache improvements under the hood for apollo and react which should give some speed-up on repeated queries.
To test, I clicked through available games and tools and all seemed to still function as before. The queries relating to courses and users and such are mostly unused though and so I am unsure if the immutability change here will break them.
This updates to the latest version of the apollo client. This version has two breaking changes that affect SpeakEasy:
The apollo folks did a lot of consolidation in the 3.0 release such that all of the disparate packages (e.g.
apollo-client
,apollo-link-http
, etc.) are now available under a singular@apollo/client
. The client also includes and re-exports thegraphql-tags
package as well. Mostly, this just meant rewriting the imports then to meet their new structure. Given that SpeakEasy does not dive deeply into the advanced functionality of configuring the client or cache, this was rather straight-forward.Any result coming from apollo is now immutable and cannot be changed. To alter a returned data set, we must first make a clone of it, and then alter that instead. This seems to occur currently only once in the codebase (https://github.com/SpeakEasy-tools/SpeakEasy/pull/117/files#diff-688806a53f2045d9839e5cbef46dc8e5R63-R65), and so would be something to remember going forward. On the upside, this move to immutability promises some amount of cache improvements under the hood for apollo and react which should give some speed-up on repeated queries.
The full migration guide is available at https://www.apollographql.com/docs/react/migrating/apollo-client-3-migration/.
To test, I clicked through available games and tools and all seemed to still function as before. The queries relating to courses and users and such are mostly unused though and so I am unsure if the immutability change here will break them.