Skip to content

Commit ee0894d

Browse files
committed
👔 Conditionally add options to hidden items to resolve disallowFreeText issue
1 parent fbfcd52 commit ee0894d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

static/app/components/searchQueryBuilder/tokens/combobox.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function menuIsOpen({
167167

168168
// When a custom menu is not being displayed and we aren't loading anything,
169169
// only show when there is something to select from.
170-
return openState && totalOptions >= hiddenOptions.size;
170+
return openState && totalOptions > hiddenOptions.size;
171171
}
172172

173173
function useHiddenItems<T extends SelectOptionOrSectionWithKey<string>>({
@@ -183,6 +183,7 @@ function useHiddenItems<T extends SelectOptionOrSectionWithKey<string>>({
183183
maxOptions?: number;
184184
shouldFilterResults?: boolean;
185185
}) {
186+
const {gaveSeerConsentRef} = useSearchQueryBuilder();
186187
const hiddenOptions: Set<SelectKey> = useMemo(() => {
187188
const options = getHiddenOptions(
188189
items,
@@ -191,12 +192,22 @@ function useHiddenItems<T extends SelectOptionOrSectionWithKey<string>>({
191192
);
192193

193194
if (showAskSeerOption) {
194-
options.add(ASK_SEER_ITEM_KEY);
195-
options.add(ASK_SEER_CONSENT_ITEM_KEY);
195+
if (gaveSeerConsentRef.current) {
196+
options.add(ASK_SEER_ITEM_KEY);
197+
} else {
198+
options.add(ASK_SEER_CONSENT_ITEM_KEY);
199+
}
196200
}
197201

198202
return options;
199-
}, [items, shouldFilterResults, filterValue, maxOptions, showAskSeerOption]);
203+
}, [
204+
filterValue,
205+
gaveSeerConsentRef,
206+
items,
207+
maxOptions,
208+
shouldFilterResults,
209+
showAskSeerOption,
210+
]);
200211

201212
const disabledKeys = useMemo(() => {
202213
const baseDisabledKeys = [...getDisabledOptions(items), ...hiddenOptions];

0 commit comments

Comments
 (0)