Commit 7e077be
Fix returning [Type, false] from resolve_type
rmosolgo#4130 fixed returning
`[Type, nil]` from a union's `resolve_type`, but it caused a regression
for literal `false` values.
`Schema#resolve_type` had a `if resolved_value` conditional would be false
for `false` values causing it _always_ return a single value (the `resolve_type`).
The runtime's `resolve_type` method would then _always_ return the tuple
version (in non-lazy cases): `[type, value]`. However, since
`Schema#resolve_type` was only returning a single value, the resolved
value would be lost resulting in `[type, nil]` being passed on.
The fix is to remove the `if resolved_value` conditional entirely and
always return the two-value tuple ensuring the original resolved value
is correctly passed along.
Note: the runtime still has a branch to check if the `resolve_type`
value is a tuple or not. The only case where this won't be true is for
lazy resolved types.1 parent 96ae99b commit 7e077be
File tree
3 files changed
+109
-34
lines changed- lib/graphql
- spec
- graphql/schema
- integration/rails/graphql
3 files changed
+109
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
785 | 785 | | |
786 | 786 | | |
787 | 787 | | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
| 788 | + | |
793 | 789 | | |
794 | 790 | | |
795 | 791 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
87 | 105 | | |
| 106 | + | |
| 107 | + | |
88 | 108 | | |
89 | 109 | | |
90 | 110 | | |
91 | 111 | | |
92 | 112 | | |
93 | 113 | | |
94 | 114 | | |
95 | | - | |
| 115 | + | |
96 | 116 | | |
97 | | - | |
| 117 | + | |
98 | 118 | | |
99 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
100 | 126 | | |
101 | 127 | | |
102 | 128 | | |
103 | 129 | | |
104 | 130 | | |
105 | | - | |
| 131 | + | |
| 132 | + | |
106 | 133 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
111 | 139 | | |
112 | | - | |
113 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
114 | 159 | | |
115 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
116 | 164 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
120 | 180 | | |
121 | 181 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
127 | 190 | | |
128 | | - | |
129 | | - | |
| 191 | + | |
130 | 192 | | |
131 | | - | |
| 193 | + | |
132 | 194 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
136 | 215 | | |
137 | 216 | | |
138 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
0 commit comments