Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 93ee9d0

Browse files
fix(rish): hide reset button when search is stalled in SearchBox (#3617)
1 parent f7251a4 commit 93ee9d0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/react-instantsearch-hooks-web/src/ui/SearchBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export function SearchBox({
207207
className={cx('ais-SearchBox-reset', classNames.reset)}
208208
type="reset"
209209
title={translations.resetTitle}
210-
hidden={value.length === 0 && !isSearchStalled}
210+
hidden={value.length === 0 || isSearchStalled}
211211
>
212212
<ResetIcon classNames={classNames} />
213213
</button>

packages/react-instantsearch-hooks-web/src/ui/__tests__/SearchBox.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,14 @@ describe('SearchBox', () => {
349349
expect(container.querySelector('.ais-SearchBox-reset')).not.toBeVisible();
350350
});
351351

352+
test('with search stalled hides the reset indicator', () => {
353+
const props = createProps({ value: 'query', isSearchStalled: true });
354+
355+
const { container } = render(<SearchBox {...props} />);
356+
357+
expect(container.querySelector('.ais-SearchBox-reset')).not.toBeVisible();
358+
});
359+
352360
test('with search stalled shows the loading indicator', () => {
353361
const props = createProps({ isSearchStalled: true });
354362

0 commit comments

Comments
 (0)