@@ -197,42 +197,30 @@ const inferSelectOneByTypeReturnStatus = (
197197} ;
198198
199199const inferSelectAllByTypeReturnStatus = (
200- _guide : KnockGuide ,
200+ guide : KnockGuide ,
201201 snapshot : StoreStateSnapshot ,
202- _stage : KnockGuideClientGroupStage ,
202+ stage : KnockGuideClientGroupStage ,
203203 query : SelectionResultByQuery ,
204204) : SelectableStatusPresent [ "status" ] => {
205205 const result = query . type ! . all ! ;
206206 if ( result . size === 0 ) {
207- // This should not happen but here for completeness.
208207 return "queried" ;
209208 }
210209
211- // If queried with useGuides (i.e. can return multiple guides), then we need
212- // to look up the actual query results to figure out how this guide may or
213- // may not be included in the result.
214-
215- // If explicitly given the option to ignore throttling, then all guides
216- // selected in this query should return.
217- const includeThrottled = ! ! query . type ?. one ?. metadata ?. opts ?. includeThrottled ;
218- if ( includeThrottled ) {
219- return "returned" ;
220- }
221-
222- const guides = [ ...result . values ( ) ]
210+ const guides = [ ...result . values ( ) ] ;
223211 const first = guides [ 0 ] ! ;
224212
225- // If not throttled, then all guides in the query result should be returned.
226- if ( ! snapshot . throttled ) {
227- return "returned"
213+ // If the first selected guide is unthrottled or resolved, then we should
214+ // have at minimum one guide to return, and potentially more based on whether
215+ // we are throttling currently and which other guides are unthrottled.
216+ if ( first . bypass_global_group_limit || first . key === stage . resolved ) {
217+ if ( snapshot . throttled ) {
218+ return guide . bypass_global_group_limit ? "returned" : "throttled" ;
219+ }
220+ return "returned" ;
228221 }
229222
230- // If being throttled, then all guides in the query result should be returned.
231- // const guides = [...result.values()];
232-
233-
234- // TODO: Placeholder to follow up.
235- return "returned" ;
223+ return "queried" ;
236224} ;
237225
238226const inferSelectReturnStatus = (
0 commit comments