-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: show a spinner when searching taxonomy #33190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pauldambra
merged 1 commit into
feat/allow-event-sorting-in-taxonomic-filter
from
feat/loader-when-searching
Jun 5, 2025
+65
−65
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,14 +36,13 @@ function CategoryPill({ | |
}): JSX.Element { | ||
const logic = infiniteListLogic({ ...taxonomicFilterLogicProps, listGroupType: groupType }) | ||
const { taxonomicGroups } = useValues(taxonomicFilterLogic) | ||
const { totalResultCount, totalListCount, isLoading, results, hasRemoteDataSource } = useValues(logic) | ||
const { totalResultCount, totalListCount, isLoading, hasRemoteDataSource } = useValues(logic) | ||
|
||
const group = taxonomicGroups.find((g) => g.type === groupType) | ||
|
||
// :TRICKY: use `totalListCount` (results + extra) to toggle interactivity, while showing `totalResultCount` | ||
const canInteract = totalListCount > 0 || taxonomicFilterGroupTypesWithEmptyStates.includes(groupType) | ||
const hasOnlyDefaultItems = results?.length === 1 && (!results[0].id || results[0].id === '') | ||
const showLoading = isLoading && (!results || results.length === 0 || hasOnlyDefaultItems) && hasRemoteDataSource | ||
const showLoading = isLoading && hasRemoteDataSource | ||
|
||
return ( | ||
<LemonTag | ||
|
@@ -76,71 +75,72 @@ function TaxonomicGroupTitle({ openTab }: { openTab: TaxonomicFilterGroupType }) | |
const { eventOrdering } = useValues(taxonomicFilterPreferencesLogic) | ||
const { setEventOrdering } = useActions(taxonomicFilterPreferencesLogic) | ||
|
||
if (openTab === TaxonomicFilterGroupType.Events) { | ||
const currentGroup = taxonomicGroups.find((g) => g.type === openTab) | ||
|
||
return ( | ||
<div className="flex flex-row justify-between items-center w-full"> | ||
<span>{currentGroup?.name || openTab}</span> | ||
<FlaggedFeature flag="taxonomic-event-sorting" match={true}> | ||
<LemonMenu | ||
items={[ | ||
{ | ||
label: ( | ||
<div className="flex flex-row gap-2"> | ||
{eventOrdering === 'name' ? <IconCheck /> : <IconBlank />} | ||
<span>Name</span> | ||
</div> | ||
), | ||
tooltip: 'Sort events alphabetically', | ||
onClick: () => { | ||
setEventOrdering('name') | ||
return ( | ||
<div className="flex flex-row justify-between items-center w-full relative"> | ||
{openTab === TaxonomicFilterGroupType.Events ? ( | ||
<> | ||
<span>{taxonomicGroups.find((g) => g.type === openTab)?.name || openTab}</span> | ||
<FlaggedFeature flag="taxonomic-event-sorting" match={true}> | ||
<LemonMenu | ||
items={[ | ||
{ | ||
label: ( | ||
<div className="flex flex-row gap-2"> | ||
{eventOrdering === 'name' ? <IconCheck /> : <IconBlank />} | ||
<span>Name</span> | ||
</div> | ||
), | ||
tooltip: 'Sort events alphabetically', | ||
onClick: () => { | ||
setEventOrdering('name') | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: ( | ||
<div className="flex flex-row gap-2"> | ||
{eventOrdering === '-last_seen_at' ? <IconCheck /> : <IconBlank />} | ||
<span>Recently seen</span> | ||
</div> | ||
), | ||
tooltip: 'Show the most recent events first', | ||
onClick: () => { | ||
setEventOrdering('-last_seen_at') | ||
{ | ||
label: ( | ||
<div className="flex flex-row gap-2"> | ||
{eventOrdering === '-last_seen_at' ? <IconCheck /> : <IconBlank />} | ||
<span>Recently seen</span> | ||
</div> | ||
), | ||
tooltip: 'Show the most recent events first', | ||
onClick: () => { | ||
setEventOrdering('-last_seen_at') | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: ( | ||
<div className="flex flex-row gap-2"> | ||
{!eventOrdering ? <IconCheck /> : <IconBlank />} | ||
<span>Both</span> | ||
</div> | ||
), | ||
tooltip: | ||
'Sorts events by the day they were last seen, and then by name. The default option.', | ||
onClick: () => { | ||
setEventOrdering(null) | ||
{ | ||
label: ( | ||
<div className="flex flex-row gap-2"> | ||
{!eventOrdering ? <IconCheck /> : <IconBlank />} | ||
<span>Both</span> | ||
Comment on lines
+113
to
+114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: 'Both' is not descriptive enough for the sorting option. Consider 'Recently seen + Name' for clarity. |
||
</div> | ||
), | ||
tooltip: | ||
'Sorts events by the day they were last seen, and then by name. The default option.', | ||
onClick: () => { | ||
setEventOrdering(null) | ||
}, | ||
}, | ||
}, | ||
]} | ||
> | ||
<LemonButton | ||
icon={<IconSort />} | ||
size="small" | ||
tooltip={`Sorting by ${ | ||
eventOrdering === '-last_seen_at' | ||
? 'recently seen' | ||
: eventOrdering === 'name' | ||
? 'name' | ||
: 'recently seen and then name' | ||
}`} | ||
/> | ||
</LemonMenu> | ||
</FlaggedFeature> | ||
</div> | ||
) | ||
} | ||
return <>{taxonomicGroups.find((g) => g.type === openTab)?.name || openTab}</> | ||
]} | ||
> | ||
<LemonButton | ||
icon={<IconSort />} | ||
size="small" | ||
tooltip={`Sorting by ${ | ||
eventOrdering === '-last_seen_at' | ||
? 'recently seen' | ||
: eventOrdering === 'name' | ||
? 'name' | ||
: 'recently seen and then name' | ||
}`} | ||
/> | ||
</LemonMenu> | ||
</FlaggedFeature> | ||
</> | ||
) : ( | ||
<>{taxonomicGroups.find((g) => g.type === openTab)?.name || openTab}</> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export function InfiniteSelectResults({ | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, i missed i had this change too.
this is just refactoring the method