zino-hofmann / graphql-flutter

A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
https://zino-hofmann.github.io/graphql-flutter
MIT License
3.24k stars 612 forks source link

feat(graphql): Reuse request results to improve performance #1452

Closed kvenn closed 1 month ago

kvenn commented 1 month ago

Problem

If you have two observables for the same request, it will unnecessarily do extra (expensive) work

Solution

I went with a solution that doesn't require changing any core flows or data structures. Slightly based on how Ferry keeps a map of requests.

The more observables you have for the same Requests, the bigger improvements you will see

Other improvement added - call maybeRebroadcast less

Addendum