Comments (4)
The effect on its own wouldn't be huge, but when you have several hundred milliseconds of React rendering also queued (performance issues that we're working on separately, ha) it can end up with a heavier impact.
I dug into zen-observable
a bit to see if there was a simple solution, but I agree that the it would make more sense to fix within RestLink. Would it be pretty straightforward to add a fast path when there are no non-rest fields? Could you do something as simple as
if (!nonRest) {
return new Observable(...);
} else {
return obs.flatMap(({data, errors}) => new Observable(...))
}
If so, I'd be happy to put up a PR to try to fix, but you definitely have more context on how the mixed support actually works.
from apollo-link-rest.
You're right there is an async boundary that gets inserted though I'm surprised it has that big an effect. I suppose one fix could be to fully separate the logic and return the Observable directly when there are no non-rest fields. Ultimately I'm not sure if we could fix the performance of the flatMap
since that comes from zen-observable
here
from apollo-link-rest.
@kyeb-stripe oh wow! I’m finding myself surprised too! Is this something you feel motivated to contribute back to this library?
Would you mind further elaborating on your use case too? The goal of this library is as a transitional tool between a REST world and true GraphQL, and there’s certain fundamental performance weaknesses that will never be resolved. For example, you can’t necessarily coalesce these API calls like you can with GraphQL. Selecting subfields still incurs the bandwidth/memory cost that you wouldn’t have with true GraphQL. Among other issues, it’s possible this will not be compatible with Suspense until ApolloClient core is, (if ever). Forgive me if I make incorrect assumptions, but surely Stripe has backend GraphQL on their roadmap?
from apollo-link-rest.
As far as I know, we're sticking to REST for the foreseeable future! For the Stripe Dashboard at least, we have a few tricks up our sleeve to reduce the memory/bandwidth cost 🙂 (feel free to reach out to me elsewhere if you want to learn more!)
I have a bit too much on my plate at the moment to fix this, but will let you know if I get some spare time to come up with a generalized fix. It's not within our use case, but ideally a fix would also remove the async-ness even with mixed queries, which the simple fix I suggested above would not do.
from apollo-link-rest.
Related Issues (20)
- Fix typo when defining type for bodySerializer on 'bodySerializer' section
- Is this repo obsolete? HOT 3
- How to batch operations with apollo-link-rest? HOT 4
- Latest possible (0.8.0) release is still in beta with no active changes HOT 5
- TypeError: Cannot read properties of undefined (reading 'selections') HOT 4
- Questions about apollo-link-rest production status HOT 8
- `graphql-anywhere` is unmaintained; how does this impact `apollo-link-rest`? HOT 17
- Use exported variable in POST request body HOT 7
- Can i use DELETE method with request body? HOT 1
- Conditionally skip REST calls HOT 8
- Apollo Link Rest - MockProvider HOT 1
- Apollo return same data even datatype and url is changed through variables HOT 1
- **Urgent**: Lost Maintainer/Collaborator Access HOT 3
- How to limit the number of items of nested array? HOT 2
- Unable to access context value in the graphql query
- Feature Proposal - RestLink chains HOT 1
- Dependency Dashboard
- data and error fields in useQuery hook empty.
- Can only the remaining uncached links be retrieved? HOT 5
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-link-rest.