You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix cases where fragment could be reused but weren't (#2541)
The main case that was handled properly was the case where a fragment
that is on an abstract type is applied somewhere where the "current
type" is an object type. In that case, some sub-parts (the one that don't
match the "curren type") of the fragment are effectively "dead branches",
but the code was still trying to matching those in the result,
preventing some reuse of the fragment.
Another smaller issue was that we sometimes weren't correctly reusing
fragments at the very top of a "selection set". This didn't really
matter too much for queries in practice, but this was also impacting
some case where fragments where use at the top level of some other
fragments, also preventing a few reuse.
Lastly, fixing this highlighted the fact that the we were always using
fragments from the original query, so against the API schema, even when
building subgraph queries, and this was creating issues (the code was
trying to compensate for this is a few places, but this was confusing
and was not covering all cases correctly). So the patch clean this
up too, and rebased fragments on subgraph before trying to use them
for optimizing said subgraph fetches, ensuring that the code don't
mix element from different schema.
0 commit comments