@@ -31,11 +31,7 @@ import {
3131} from 'sentry/components/searchQueryBuilder/tokens/filterKeyListBox/utils' ;
3232import { itemIsSection } from 'sentry/components/searchQueryBuilder/tokens/utils' ;
3333import type { FieldDefinitionGetter } from 'sentry/components/searchQueryBuilder/types' ;
34- import type {
35- ParseResultToken ,
36- Token ,
37- TokenResult ,
38- } from 'sentry/components/searchSyntax/parser' ;
34+ import type { Token , TokenResult } from 'sentry/components/searchSyntax/parser' ;
3935import { getKeyName } from 'sentry/components/searchSyntax/utils' ;
4036import type { RecentSearch , TagCollection } from 'sentry/types/group' ;
4137import { trackAnalytics } from 'sentry/utils/analytics' ;
@@ -134,9 +130,7 @@ function useFilterKeyItems() {
134130
135131function useFilterKeySections ( {
136132 recentSearches,
137- filterItem,
138133} : {
139- filterItem : Node < ParseResultToken > ;
140134 recentSearches : RecentSearch [ ] | undefined ;
141135} ) {
142136 const { filterKeySections, query, disallowLogicalOperators} = useSearchQueryBuilder ( ) ;
@@ -155,22 +149,21 @@ function useFilterKeySections({
155149 return [ ] ;
156150 }
157151
158- const isFirstItem = filterItem . key . toString ( ) . endsWith ( ':0' ) ;
159152 if ( recentSearches ?. length && ! query ) {
160153 const recentSearchesSections : Section [ ] = [
161154 RECENT_SEARCH_CATEGORY ,
162155 ALL_CATEGORY ,
163156 ...definedSections ,
164157 ] ;
165158
166- if ( ! disallowLogicalOperators && ! isFirstItem && hasConditionalsInCombobox ) {
159+ if ( ! disallowLogicalOperators && hasConditionalsInCombobox ) {
167160 recentSearchesSections . push ( LOGIC_CATEGORY ) ;
168161 }
169162 return recentSearchesSections ;
170163 }
171164
172165 const customSections : Section [ ] = [ ALL_CATEGORY , ...definedSections ] ;
173- if ( ! disallowLogicalOperators && ! isFirstItem && hasConditionalsInCombobox ) {
166+ if ( ! disallowLogicalOperators && hasConditionalsInCombobox ) {
174167 customSections . push ( LOGIC_CATEGORY ) ;
175168 }
176169
@@ -179,7 +172,6 @@ function useFilterKeySections({
179172 disallowLogicalOperators ,
180173 filterKeySections ,
181174 hasConditionalsInCombobox ,
182- filterItem . key ,
183175 query ,
184176 recentSearches ?. length ,
185177 ] ) ;
@@ -200,19 +192,18 @@ function useFilterKeySections({
200192 return { sections, selectedSection, setSelectedSection} ;
201193}
202194
203- const conditionalFilterItems = [
195+ const logicFilterItems = [
204196 createLogicFilterItem ( { value : 'AND' } ) ,
205197 createLogicFilterItem ( { value : 'OR' } ) ,
206198 createLogicFilterItem ( { value : '(' } ) ,
207199 createLogicFilterItem ( { value : ')' } ) ,
208200] ;
209201
210202interface UseFilterKeyListBoxArgs {
211- filterItem : Node < ParseResultToken > ;
212203 filterValue : string ;
213204}
214205
215- export function useFilterKeyListBox ( { filterValue, filterItem } : UseFilterKeyListBoxArgs ) {
206+ export function useFilterKeyListBox ( { filterValue} : UseFilterKeyListBoxArgs ) {
216207 const {
217208 filterKeys,
218209 getFieldDefinition,
@@ -228,7 +219,6 @@ export function useFilterKeyListBox({filterValue, filterItem}: UseFilterKeyListB
228219 const { data : recentSearches } = useRecentSearches ( ) ;
229220 const { sections, selectedSection, setSelectedSection} = useFilterKeySections ( {
230221 recentSearches,
231- filterItem,
232222 } ) ;
233223
234224 const organization = useOrganization ( ) ;
@@ -270,7 +260,7 @@ export function useFilterKeyListBox({filterValue, filterItem}: UseFilterKeyListB
270260 selectedSection === LOGIC_CATEGORY_VALUE &&
271261 hasConditionalsInCombobox
272262 ) {
273- return [ ...askSeerItem , ...conditionalFilterItems ] ;
263+ return [ ...askSeerItem , ...logicFilterItems ] ;
274264 }
275265
276266 const filteredByCategory = sectionedItems . filter ( item => {
0 commit comments