diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed8944f7..6bd8e719 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,9 @@
# Change history for ui-linked-data
## 3.0.0 (IN PROGRESS)
+* Fix Reset search option is missing after using Advanced Search. Fixes [UILD-812].
+
+[UILD-792]:https://folio-org.atlassian.net/browse/UILD-812
## 2.0.2 (2026-05-07)
* Fix Sonar issues. Refs [UILD-792].
diff --git a/src/features/search/ui/components/SearchControls/ResetButton.test.tsx b/src/features/search/ui/components/SearchControls/ResetButton.test.tsx
index 8a4dee22..bc47fa74 100644
--- a/src/features/search/ui/components/SearchControls/ResetButton.test.tsx
+++ b/src/features/search/ui/components/SearchControls/ResetButton.test.tsx
@@ -1,5 +1,7 @@
import { setInitialGlobalState } from '@/test/__mocks__/store';
+import { MemoryRouter } from 'react-router-dom';
+
import { fireEvent, render, screen } from '@testing-library/react';
import { useSearchStore } from '@/store';
@@ -30,7 +32,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
expect(screen.getByTestId('id-search-reset-button')).toBeInTheDocument();
expect(screen.getByText('ld.reset')).toBeInTheDocument();
@@ -46,7 +52,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
expect(screen.getByTestId('x-in-circle-icon')).toBeInTheDocument();
});
@@ -61,7 +71,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
const button = screen.getByTestId('id-search-reset-button');
expect(button).not.toBeDisabled();
@@ -77,7 +91,51 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
+
+ const button = screen.getByTestId('id-search-reset-button');
+ expect(button).toBeDisabled();
+ });
+
+ test('button is enabled when advanced search is active', () => {
+ setInitialGlobalState([
+ {
+ store: useSearchStore,
+ state: {
+ query: '',
+ },
+ },
+ ]);
+
+ render(
+
+
+ ,
+ );
+
+ const button = screen.getByTestId('id-search-reset-button');
+ expect(button).not.toBeDisabled();
+ });
+
+ test('button is disabled when query is empty and no advanced search is active', () => {
+ setInitialGlobalState([
+ {
+ store: useSearchStore,
+ state: {
+ query: '',
+ },
+ },
+ ]);
+
+ render(
+
+
+ ,
+ );
const button = screen.getByTestId('id-search-reset-button');
expect(button).toBeDisabled();
@@ -93,7 +151,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
const button = screen.getByTestId('id-search-reset-button');
fireEvent.click(button);
@@ -111,7 +173,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
const button = screen.getByTestId('id-search-reset-button');
fireEvent.click(button);
@@ -129,7 +195,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
const button = screen.getByTestId('id-search-reset-button');
expect(button).toHaveClass('search-button');
@@ -145,7 +215,11 @@ describe('ResetButton', () => {
},
]);
- render();
+ render(
+
+
+ ,
+ );
const button = screen.getByTestId('id-search-reset-button');
expect(button).toHaveAttribute('aria-label');
diff --git a/src/features/search/ui/components/SearchControls/ResetButton.tsx b/src/features/search/ui/components/SearchControls/ResetButton.tsx
index 700378ae..2fadeb95 100644
--- a/src/features/search/ui/components/SearchControls/ResetButton.tsx
+++ b/src/features/search/ui/components/SearchControls/ResetButton.tsx
@@ -1,8 +1,11 @@
import { FC } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
+import { useSearchParams } from 'react-router-dom';
import { Button, ButtonType } from '@/components/Button';
+import { SearchParam } from '@/features/search/core';
+
import { useSearchState } from '@/store';
import XInCircle from '@/assets/x-in-circle.svg?react';
@@ -11,10 +14,12 @@ import { useSearchContext } from '../../providers/SearchProvider';
export const ResetButton: FC = () => {
const { formatMessage } = useIntl();
+ const [searchParams] = useSearchParams();
const { onReset } = useSearchContext();
const { query } = useSearchState(['query']);
- const isDisabled = !query;
+ const isAdvancedSearch = !!searchParams.get(SearchParam.QUERY) && !searchParams.get(SearchParam.SEARCH_BY);
+ const isDisabled = !query && !isAdvancedSearch;
return (