diff --git a/gradle/changelog/enhance_searchpage.yaml b/gradle/changelog/enhance_searchpage.yaml new file mode 100644 index 0000000000..1437818726 --- /dev/null +++ b/gradle/changelog/enhance_searchpage.yaml @@ -0,0 +1,2 @@ +- type: changed + description: Search category stays the same when the search query is modified diff --git a/scm-ui/ui-webapp/src/containers/OmniSearch.tsx b/scm-ui/ui-webapp/src/containers/OmniSearch.tsx index 870bb356cd..be4200d2c5 100644 --- a/scm-ui/ui-webapp/src/containers/OmniSearch.tsx +++ b/scm-ui/ui-webapp/src/containers/OmniSearch.tsx @@ -39,6 +39,7 @@ type Props = { shouldClear: boolean; ariaId: string; nextFocusRef: RefObject; + selectedType?: string; }; type GuardProps = Props & { @@ -121,7 +122,7 @@ const useSearchParams = () => { }; }; -const OmniSearch: FC = ({ shouldClear }) => { +const OmniSearch: FC = ({ shouldClear, selectedType = "repository" }) => { const [t] = useTranslation("commons"); const { initialQuery } = useSearchParams(); const [query, setQuery] = useState(shouldClear ? "" : initialQuery); @@ -173,7 +174,7 @@ const OmniSearch: FC = ({ shouldClear }) => { ); } @@ -181,7 +182,7 @@ const OmniSearch: FC = ({ shouldClear }) => { ); hits?.forEach((hit, idx) => { @@ -195,7 +196,7 @@ const OmniSearch: FC = ({ shouldClear }) => { ); }); return newEntries; - }, [context.name, context.namespace, hits, id, query, searchTypes, t]); + }, [context.name, context.namespace, hits, id, query, searchTypes, selectedType, t]); return (
{showHelp ? : null} diff --git a/scm-ui/ui-webapp/src/search/Search.tsx b/scm-ui/ui-webapp/src/search/Search.tsx index 2d7d6b670f..98184b6513 100644 --- a/scm-ui/ui-webapp/src/search/Search.tsx +++ b/scm-ui/ui-webapp/src/search/Search.tsx @@ -158,7 +158,7 @@ const SearchSubTitle: FC = ({ selectedType, queryResult, links }) => {
]} /> - + );