Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 407c562

Browse files
Hubert KosterHubert Koster
authored andcommitted
chore: small refactor
1 parent a3f30cb commit 407c562

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/UserNavbarItem/item.desktop.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ const UserNavbarDesktopItem = ({ authUrl, is_logged_in }: IUserNavbarItemProps)
1111
const location = useLocation();
1212
const nav_ref = useRef(null);
1313

14-
useEffect(() => {
15-
setToggleSearch(false);
16-
}, [location]);
17-
1814
// This is the only React way to access and focus the search input from the 3rd party library we use
1915
const focusSearchInput = () => {
2016
// For some reason, this library wraps the search in a new element after triggering the search the first time
@@ -40,6 +36,10 @@ const UserNavbarDesktopItem = ({ authUrl, is_logged_in }: IUserNavbarItemProps)
4036
if (press_cmd_and_k) setToggleSearch(true);
4137
};
4238

39+
useEffect(() => {
40+
setToggleSearch(false);
41+
}, [location]);
42+
4343
useEffect(() => {
4444
if (toggle_search) {
4545
focusSearchInput();

0 commit comments

Comments
 (0)