Giter Site home page Giter Site logo

Comments (4)

kyeb-stripe avatar kyeb-stripe commented on July 30, 2024 2

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.

paulpdaniels avatar paulpdaniels commented on July 30, 2024

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.

fbartho avatar fbartho commented on July 30, 2024

@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.

kyeb-stripe avatar kyeb-stripe commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.