fix: Refreshing search page with special character in query does not reflect

fix: Search query that looks like regex causes JS error
This commit is contained in:
Tom Moor
2019-10-27 22:34:11 -07:00
parent 77153a2529
commit f7a9152ee3
2 changed files with 2 additions and 2 deletions

View File

@@ -141,7 +141,7 @@ class DocumentPreview extends React.Component<Props> {
const queryIsInTitle =
!!highlight &&
!!document.title.toLowerCase().match(highlight.toLowerCase());
!!document.title.toLowerCase().includes(highlight.toLowerCase());
return (
<DocumentLink

View File

@@ -106,7 +106,7 @@ class Search extends React.Component<Props> {
};
handleTermChange = () => {
const query = this.props.match.params.term;
const query = decodeURIComponent(this.props.match.params.term || '');
this.query = query ? query : '';
this.offset = 0;
this.allowLoadMore = true;