Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Apollo Client 3 updates #48

Closed
wants to merge 14 commits into from
Closed

Apollo Client 3 updates #48

wants to merge 14 commits into from

Conversation

hwillson
Copy link
Member

This PR covers the updates required to work with Apollo Client 3, now that the Apollo Link core is part of @apollo/client. It also introduces a new package naming structure of @apollo/link-persisted-queries. Note that @apollo/client is still in beta, so this PR shouldn't be merged yet. When it is merged, we're going to release this package as a 1.0 version.

@codecov-io
Copy link

codecov-io commented Jan 30, 2020

Codecov Report

Merging #48 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #48      +/-   ##
==========================================
+ Coverage   98.76%   98.79%   +0.02%     
==========================================
  Files           2        2              
  Lines          81       83       +2     
  Branches       23       23              
==========================================
+ Hits           80       82       +2     
  Misses          1        1
Impacted Files Coverage Δ
src/index.ts 98.78% <100%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 974edc3...d80105e. Read the comment docs.

@AdrienLemaire
Copy link

@hwillson thanks for your work!

@jbaxleyiii this repository looks sadly abandoned with no new commit since the end of 2018. Can you get someone to maintain this repo and merge this PR which looks like the fix for my issue at #51?

package.json Outdated Show resolved Hide resolved
import { InMemoryCache } from "apollo-cache-inmemory";
import ApolloClient from "apollo-client";

import { createPersistedQueryLink } from "@apollo/link-persisted-queries";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we lazy load this link, thus lazy-load the heavy graphql library that is used behind? It's only used for APQ, right? I've noticed that it's even bigger than react-dom. It would be nice to load fast first (and show cache data if available), then improve network performances with link-persisted-queries.

@moberegger
Copy link

Hey @hwillson! Is this still on the roadmap as a candidate to be released? Or is this something that is planned to be released as part of the core Apollo package?

I'm working on the upgrade to Apollo Client 3 and I'm stuck on this package as I am unsure what to do for the upgrade path.

@maxlew
Copy link

maxlew commented Jul 24, 2020

It seems like this repo does still work with the @apollo/client#3.0.0 package. Would be good to get an update from one of the maintainers as to what the status of the package is going forwards, @hwillson mentioned it would become part of the core @apollo package in the initial PR. I've noticed though that the v3 client docs have removed most mentions of persisted queries 😬

The minimal example that's working for me is below.

import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client';
import { createPersistedQueryLink } from 'apollo-link-persisted-queries';

const link = createPersistedQueryLink({
  useGETForHashedQueries: true,
}).concat(new HttpLink({ uri: 'https://example.com' }));


const client = new ApolloClient({
  link,
  cache: new InMemoryCache(),
});

@hwillson hwillson requested a review from benjamn August 1, 2020 15:20
@benjamn
Copy link
Member

benjamn commented Aug 5, 2020

@hwillson Since Apollo maintains this link, and this PR is already planning to rename the npm package from apollo-link-persisted-queries to @apollo/link-persisted-queries, what if we moved this link to @apollo/client/link/persisted-queries? I feel like we have a lot of the packaging/bundling infrastructure that we're replicating here figured out over there, already.

@hwillson
Copy link
Member Author

Just a quick update here - we've discussed this internally and are going to move this link into the https://github.com/apollographql/apollo-client repo. That work will be done shortly.

@hwillson
Copy link
Member Author

This work is being continued in apollographql/apollo-client#6837.

@hwillson hwillson closed this Aug 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants