wasyl
06/02/2021, 12:13 PMFoo(a, b)
and it will make network request that finishes after ~500ms. ~200ms from the first query I make second, same Foo(a, b)
query, so the first one is still running.
Would it make sense for Apollo to merge the same requests internally, and if a network request is already running — just attach the new observer to the existing one and share the result? Similarly, everything related to observing the cache could be shared as well.
This is something that could be done on the app side, but seems like a useful optimisation that could be part of Apollo. Any thoughts on this?mbonnin
06/02/2021, 12:16 PMmbonnin
06/02/2021, 12:18 PMwasyl
06/02/2021, 12:24 PM(if polling for an example)that’s related more the latter part, about sharing observing cache, right? Or you mean some people would want to make network requests so often that they overlap, and they still want each overlapping request to hit the remote server?
wasyl
06/02/2021, 12:25 PMmbonnin
06/02/2021, 12:25 PMsome people would want to make network requests so often that they overlapYea that sounds like a stretch but this is what I meant indeed...
mbonnin
06/02/2021, 12:25 PMmbonnin
06/02/2021, 12:27 PMwasyl
06/02/2021, 12:27 PMmbonnin
06/02/2021, 12:29 PMmbonnin
06/02/2021, 12:31 PMwasyl
06/02/2021, 12:32 PMmbonnin
06/02/2021, 12:33 PMmbonnin
06/02/2021, 12:33 PMwasyl
06/02/2021, 12:36 PMmbonnin
06/02/2021, 12:38 PMwasyl
06/02/2021, 12:49 PMmbonnin
06/02/2021, 1:03 PMdev-3.x
if you're willing to try it out. Maybe a custom DedupHttpTransport
that maintains a set of queries in flight.mbonnin
06/02/2021, 1:08 PMwasyl
06/02/2021, 1:11 PMI’d do that inDepends on how much breaking changes there are 😄 I only have one, not trivial, project I can try stuff onif you’re willing to try it out.dev-3.x
mbonnin
06/02/2021, 1:12 PMmbonnin
06/02/2021, 1:13 PMmain
mbonnin
06/02/2021, 1:14 PMmain
is more difficult because it doesn't allow modifying the last interceptors in the chainwasyl
06/02/2021, 1:15 PMmbonnin
06/02/2021, 1:17 PMmbonnin
06/02/2021, 1:19 PMwasyl
06/02/2021, 1:22 PMwasyl
06/02/2021, 1:23 PMmbonnin
06/02/2021, 1:23 PM