diff --git a/client/src/components/search/searchBar/SearchSuggestion.js b/client/src/components/search/searchBar/SearchSuggestion.js
index 4541a51faf..61b6b8df41 100644
--- a/client/src/components/search/searchBar/SearchSuggestion.js
+++ b/client/src/components/search/searchBar/SearchSuggestion.js
@@ -4,7 +4,7 @@ import { Highlight } from 'react-instantsearch-dom';
import { isEmpty } from 'lodash';
const Suggestion = ({ handleSubmit, hit }) => {
- return isEmpty(hit) ? null : (
+ return isEmpty(hit) || isEmpty(hit.objectID) ? null : (
{hit.objectID.includes('default-hit-') ? (
diff --git a/client/src/pages/search.js b/client/src/pages/search.js
index 6b661e7f68..173152ad0d 100644
--- a/client/src/pages/search.js
+++ b/client/src/pages/search.js
@@ -1,22 +1,45 @@
-import React, { Fragment } from 'react';
+import React, { Fragment, Component } from 'react';
+import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
import { Index, PoweredBy } from 'react-instantsearch-dom';
+import { Grid, Row, Col } from '@freecodecamp/react-bootstrap';
+import { updateSearchQuery } from '../components/search/redux';
import SearchPageHits from '../components/search/searchPage/SearchPageHits';
-function SearchPage() {
- return (
-
-
-
-
-
-
-
-
-
- );
+const propTypes = { updateSearchQuery: PropTypes.func.isRequired };
+
+const mapDispatchToProps = { updateSearchQuery };
+
+class SearchPage extends Component {
+ componentWillUnmount() {
+ this.props.updateSearchQuery('');
+ }
+ render() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
}
SearchPage.displayName = 'SearchPage';
+SearchPage.propTypes = propTypes;
-export default SearchPage;
+export default connect(
+ null,
+ mapDispatchToProps
+)(SearchPage);