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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user