Commit e0a5075
Fragment variable definitions erased in subgraph queries (#3119)
Fixes #3112
Before creating an Operation, we call `collectUsedVariables`, which will
only pull values from the selection set and not from fragments. This
isn't great, because a variable used in a fragment won't be collected,
and it doesn't make sense to collect variables from fragments because
it's before they are optimized and many will be unused.
The inelegant solution I came up with is to pass in available variables
in calls to `optimize` or `generateQueryFragments` for an operation
where we can add back in the unused variables. This should be ok,
because we are guaranteed that exactly one of them will get called by
`toPlanNode`. Pretty sure there won't be too much overhead added because
we'll only call this once per subgraph fetch.
---------
Co-authored-by: Sachin D. Shinde <sachin@apollographql.com>1 parent 02c2a34 commit e0a5075
3 files changed
Lines changed: 64 additions & 7 deletions
File tree
- .changeset
- internals-js/src
- query-planner-js/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
934 | 936 | | |
935 | 937 | | |
936 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
937 | 951 | | |
938 | 952 | | |
939 | | - | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
940 | 958 | | |
941 | 959 | | |
942 | 960 | | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
943 | 971 | | |
944 | 972 | | |
945 | 973 | | |
946 | 974 | | |
947 | 975 | | |
948 | | - | |
| 976 | + | |
949 | 977 | | |
950 | 978 | | |
951 | 979 | | |
952 | 980 | | |
953 | 981 | | |
954 | 982 | | |
955 | | - | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
956 | 988 | | |
957 | 989 | | |
958 | 990 | | |
| |||
1001 | 1033 | | |
1002 | 1034 | | |
1003 | 1035 | | |
1004 | | - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1005 | 1041 | | |
1006 | 1042 | | |
1007 | 1043 | | |
1008 | 1044 | | |
| 1045 | + | |
1009 | 1046 | | |
1010 | 1047 | | |
1011 | 1048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| 66 | + | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
1591 | 1592 | | |
1592 | 1593 | | |
1593 | 1594 | | |
1594 | | - | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
1595 | 1600 | | |
1596 | 1601 | | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
1597 | 1611 | | |
1598 | 1612 | | |
1599 | 1613 | | |
1600 | 1614 | | |
1601 | 1615 | | |
1602 | 1616 | | |
1603 | | - | |
| 1617 | + | |
1604 | 1618 | | |
1605 | 1619 | | |
1606 | 1620 | | |
| |||
0 commit comments