Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added page reload check if the current page is not a search page #63

Merged
merged 1 commit into from
Sep 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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