Skip to content

Commit

Permalink
Added page reload check if the current page is not a search page (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
petro97 authored Sep 20, 2020
1 parent 8ed5fbb commit 43bb566
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SearchButtonMic = (props: any) => (
{...props} /> :
<span className="VoiceSearchButton"
{...props} />
)
);

export const SearchBar: React.FC<SearchBoxProps> = () => {
const { t } = useTranslation();
Expand All @@ -40,7 +40,9 @@ export const SearchBar: React.FC<SearchBoxProps> = () => {
event.preventDefault();
setHitsVisible(false);
const searchUrl = createSearchUrl();
history.push(searchUrl);
if(searchUrl !== history.location.pathname) {
history.push(searchUrl);
}
};

const handleFocus = () => {
Expand Down Expand Up @@ -74,7 +76,7 @@ export const SearchBar: React.FC<SearchBoxProps> = () => {
onClick={() => handleFocus()}
/>
) : null
)
);

const Hit = ({ hit }: any) => {
return (
Expand Down

0 comments on commit 43bb566

Please sign in to comment.