Skip to content

Commit

Permalink
Only clear similarity search when removing similarity pill
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed Oct 8, 2024
1 parent f4561cc commit 8df8637
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/src/components/input/InputWithTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ export default function InputWithTags({
setIsSimilaritySearch(false);
}, [setFilters, resetSuggestions, setSearch, setInputFocused]);

const handleClearSimilarity = useCallback(() => {
removeFilter("event_id", filters.event_id!);
removeFilter("search_type", "similarity");
}, [removeFilter, filters]);

const handleInputBlur = useCallback(
(e: React.FocusEvent) => {
if (
Expand Down Expand Up @@ -638,7 +643,7 @@ export default function InputWithTags({
<span className="inline-flex items-center whitespace-nowrap rounded-full bg-blue-100 px-2 py-0.5 text-sm text-blue-800">
Similarity Search
<button
onClick={handleClearInput}
onClick={handleClearSimilarity}
className="ml-1 focus:outline-none"
aria-label="Clear similarity search"
>
Expand Down

0 comments on commit 8df8637

Please sign in to comment.