Comments (12)
Sorry thats a yes! Instead of reinventing the wheel here and across all the other http link packages, we will have an Apollo maintained package of helpers to use for most of the implementation.
from apollo-upload-client.
I'm not sure. Doesn't it just replace the query with a hash?
from apollo-upload-client.
Yeah it should, but I'm still seeing the full query being sent over the wire all the time!
from apollo-upload-client.
Here are the changes I've made:
- Added a persisted query store to Engine:
new Engine({
engineConfig: {
+ stores: [
+ {
+ name: 'pq',
+ inMemory: {
+ cacheSize: '5000000',
+ },
+ },
+ ],
+ persistedQueries: {
+ store: 'pq',
+ },
},
});
- Added
apollo-link-persisted-queries
:
+ import { createPersistedQueryLink } from 'apollo-link-persisted-queries';
- const httpLink = createUploadLink({ /* ... */ });
+ const httpLink = createPersistedQueryLink().concat(
+ createUploadLink({ /* ... */ })
+ );
Then I open my frontend and look in the dev tools, and what I see is this:
Every single API request still sends the entire query text to the server 😕 /cc @jbaxleyiii
from apollo-upload-client.
@mxstbr @jaydenseric ah yes! Here is the solution that will need to be implemented in the upload client:
The persisted query link sets a couple items on the context (https://github.com/apollographql/apollo-link-persisted-queries/blob/master/src/index.ts#L128-L131). These are used to tell downstream network (ws, upload, http) that we want to not send the operation, but instead send the extensions.
Network links can then read them and do this and this to attach the payload correctly.
Happy to help with any questions!
from apollo-upload-client.
@jaydenseric also, I'm wondering if you could implement the upload portion of this library as a custom fetcher for http-link that way you don't have to keep things in sync?
https://www.apollographql.com/docs/link/links/http.html#custom
from apollo-upload-client.
@jbaxleyiii I think that might not work, because the File
and FileList
instances in variables
would have been lost when the request body was JSON encoded.
from apollo-upload-client.
@jaydenseric can we add support for persisted queries anyways by adding those options to the context, even if it can't be a custom fetcher?
from apollo-upload-client.
The way forward is to use apollo-link-utilities
once it has stabilised in this PR.
from apollo-upload-client.
Is that a yes or a no? 😆
from apollo-upload-client.
Oh I see, thanks! Can't wait ✨
from apollo-upload-client.
@mxstbr would you like to verify this works as expected with [email protected]
?
from apollo-upload-client.
Related Issues (20)
- The package may have incorrect main/module/exports specified in its package.json: Missing "." HOT 2
- fix types HOT 1
- Clarification on exports/imports HOT 11
- latest version of the package failed to compile HOT 2
- Type Incompatibility in Apollo Client 3.8 HOT 2
- how to use version 18.0.0 with webpack and typescript HOT 3
- documentation update HOT 1
- crash with recommended ts parameters of release 18.0.0 HOT 4
- Module not found - after updating to 18.0.1 HOT 2
- Problem with Typescript HOT 2
- Document required TypeScript libs HOT 1
- How do you use ReactNativeFile in the latest version HOT 3
- Error with Vite HOT 1
- Failed to resolve entry for package "apollo-upload-client". HOT 2
- Support for @defer directive?
- Version 18 doesn't work with React Native HOT 2
- Module not found HOT 2
- Broken compatibility with HotChocolate 13.2 -> HOT 1
- Why js instead of ts? HOT 3
- Version 18 incompatible with Next.js HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-upload-client.