Skip to content

Commit 1a21932

Browse files
committed
refactor: simplify filter click handler in Chat
1 parent 7bae783 commit 1a21932

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

  • packages/instantsearch.js/src/widgets/chat

packages/instantsearch.js/src/widgets/chat/chat.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,9 @@ function createCarouselTool<
122122
const items = output?.hits || [];
123123
const suggestedFilters = output?.suggestedFilters || [];
124124

125-
const handleFilterClick = (
126-
attribute: string,
127-
value: string,
128-
isRefined: boolean
129-
) => {
130-
const action = isRefined ? 'Remove' : 'Apply';
125+
const handleFilterClick = (attribute: string, value: string) => {
131126
sendMessage({
132-
text: `${action} the ${attribute} filter: ${value}`,
127+
text: `Apply the ${attribute} filter: ${value}`,
133128
});
134129
};
135130

@@ -199,7 +194,6 @@ function createCarouselTool<
199194
<SuggestedFilters
200195
filters={suggestedFilters}
201196
onFilterClick={handleFilterClick}
202-
indexUiState={indexUiState}
203197
/>
204198
)}
205199
</Fragment>

0 commit comments

Comments
 (0)