Skip to content

Commit 3eb5550

Browse files
authored
ref(search): Enable search without waiting for search groups to load (#29336)
Previously, when waiting for tags to load you wouldn't be able to execute a search. This is not that great as some tags take a very long time to load values.
1 parent 4ceb328 commit 3eb5550

File tree

1 file changed

+7
-6
lines changed
  • static/app/components/smartSearchBar

1 file changed

+7
-6
lines changed

static/app/components/smartSearchBar/index.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,10 @@ class SmartSearchBar extends React.Component<Props, State> {
471471

472472
callIfFunction(onKeyDown, evt);
473473

474-
if (!this.state.searchGroups.length) {
475-
return;
476-
}
477-
474+
const hasSearchGroups = this.state.searchGroups.length > 0;
478475
const isSelectingDropdownItems = this.state.activeSearchItem !== -1;
479476

480-
if (key === 'ArrowDown' || key === 'ArrowUp') {
477+
if ((key === 'ArrowDown' || key === 'ArrowUp') && hasSearchGroups) {
481478
evt.preventDefault();
482479

483480
const {flatSearchItems, activeSearchItem} = this.state;
@@ -529,7 +526,11 @@ class SmartSearchBar extends React.Component<Props, State> {
529526
this.setState({searchGroups, activeSearchItem: nextActiveSearchItem});
530527
}
531528

532-
if ((key === 'Tab' || key === 'Enter') && isSelectingDropdownItems) {
529+
if (
530+
(key === 'Tab' || key === 'Enter') &&
531+
isSelectingDropdownItems &&
532+
hasSearchGroups
533+
) {
533534
evt.preventDefault();
534535

535536
const {activeSearchItem, searchGroups} = this.state;

0 commit comments

Comments
 (0)