Always persist search
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
7c2611ffdb
commit
2abf4a4c8c
1 changed files with 1 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import React, { useCallback, useEffect } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
@ -135,16 +135,6 @@ const Search = (props: ISearch) => {
|
||||||
componentProps.autoSelect = false;
|
componentProps.autoSelect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => () => {
|
|
||||||
const newPath = history.location.pathname;
|
|
||||||
const shouldPersistSearch = !!newPath.match(/@.+\/posts\/[a-zA-Z0-9]+/g)
|
|
||||||
|| !!newPath.match(/\/tags\/.+/g);
|
|
||||||
|
|
||||||
if (!shouldPersistSearch) {
|
|
||||||
dispatch(changeSearch(''));
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx('w-full', {
|
className={clsx('w-full', {
|
||||||
|
|
Loading…
Reference in a new issue