|
@@ -15,7 +15,7 @@ import ProfileModal from "../common/ProfileModal";
|
|
|
import LayerContainer from "@src/containers/common/LayerContainer";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
import useLogin from "@src/hooks/useLogin";
|
|
|
-import { useHistory } from "react-router";
|
|
|
+import { useHistory, useLocation } from "react-router";
|
|
|
import { fetchUserInfo } from "@src/store/reducers/UserReducer";
|
|
|
import { YoutubeIcon } from "../common/icon/youtube";
|
|
|
import { useDebounce, useOnClickOutside} from "usehooks-ts";
|
|
@@ -32,6 +32,7 @@ const Header: React.FC = () => {
|
|
|
const { userInfo, isUserInfoLoaded } = useSelector((store) => store.user);
|
|
|
const onSearch = () => {
|
|
|
history.push(URLInfo.getSearchResultUrl(keyword));
|
|
|
+ setShowAutoComplete(false)
|
|
|
};
|
|
|
const SelectTextComplete = (text: string) => {
|
|
|
history.push(URLInfo.getSearchResultUrl(text));
|
|
@@ -42,6 +43,7 @@ const Header: React.FC = () => {
|
|
|
const debouncedValue = useDebounce<string>(keyword, 1000)
|
|
|
const [showCommunity, setShowCommunity] = useState(false);
|
|
|
const [showProfile, setShowProfile] = useState<boolean>(false);
|
|
|
+ const location = useLocation();
|
|
|
const { handleClickLoginButton, loginText } = useLogin();
|
|
|
const { hint } = useSelector((state) => state.explore)
|
|
|
useEffect(() => {
|
|
@@ -72,6 +74,12 @@ const Header: React.FC = () => {
|
|
|
dispatchHint(keyword)
|
|
|
}, [debouncedValue]);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if(!URLInfo.isExplorePage(location)){
|
|
|
+ setKeyword('')
|
|
|
+ }
|
|
|
+ }, [location])
|
|
|
+
|
|
|
return (
|
|
|
<div className={cx("header_wrap")}>
|
|
|
<div className={cx("header_group")}>
|