Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
reagan-meant committed Oct 24, 2024
1 parent 71d7c44 commit 7752cfd
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { PatientSearchContext } from '../patient-search-context';
import useArrowNavigation from '../hooks/useArrowNavigation';
import PatientSearch from '../compact-patient-search/patient-search.component';
import styles from './compact-patient-search.scss';
import { useSearchParams } from 'react-router-dom';
import { inferModeFromSearchParams } from '../mpi/utils';

interface CompactPatientSearchProps {
initialSearchTerm: string;
Expand All @@ -27,7 +29,13 @@ const CompactPatientSearchComponent: React.FC<CompactPatientSearchProps> = ({
const bannerContainerRef = useRef(null);
const [searchTerm, setSearchTerm] = useState(initialSearchTerm);
const showSearchResults = useMemo(() => !!searchTerm?.trim(), [searchTerm]);
const patientSearchResponse = useInfinitePatientSearch(searchTerm, config.includeDead, showSearchResults);
const [searchParams] = useSearchParams();
const patientSearchResponse = useInfinitePatientSearch(
searchTerm,
inferModeFromSearchParams(searchParams),
config.includeDead,
showSearchResults,
);
const { data: patients } = patientSearchResponse;

const handleChange = useCallback((val) => setSearchTerm(val), [setSearchTerm]);
Expand Down

0 comments on commit 7752cfd

Please sign in to comment.