Skip to content

Commit 5771924

Browse files
committed
touch up
1 parent 1bc86f9 commit 5771924

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

packages/react/src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,25 @@ const inferSelectOneByTypeReturnStatus = (
160160
): SelectableStatusPresent["status"] => {
161161
const includeThrottled = !!query.type?.one?.metadata?.opts?.includeThrottled;
162162

163+
const result = query.type!.one!;
164+
if (result.size === 0) {
165+
return "queried";
166+
}
167+
163168
// There may be multiple unthrottled guides of the same type, being queried
164169
// by type to return a single guide, for example: useGuide({ type: "card" }).
165170
//
166171
// So it is possible for an unthrottled guide to be shadowed by another
167172
// unthrottled guide of the same type with higher priority, so we need to
168173
// look at the query result to determine its return status.
169174
if (guide.bypass_global_group_limit) {
170-
const result = query.type!.one!;
171-
if (result.size === 0) {
172-
// This should never happen but for completeness.
173-
return "queried";
174-
}
175+
const guides = [...result.values()];
176+
const first = guides[0]!;
175177

176-
const [_, first] = [...result][0]!;
177178
if (first.key !== guide.key) {
178179
// Being shadowed by another guide with higher priority.
179180
return "queried";
180181
}
181-
182182
return "returned";
183183
}
184184

0 commit comments

Comments
 (0)