Skip to content

Commit bc2cc2c

Browse files
author
Andrew Brookins
committed
Only initialize search code once
1 parent 07cd106 commit bc2cc2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/theme/Search/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,15 @@ function getWithExpiry(key) {
5151

5252

5353
function Search(props) {
54+
var initialized = false;
55+
5456
useEffect(function onFirstMount() {
57+
console.log("Mounted")
5558
const searchLogo = document.querySelector('.redisearch-logo')
5659
var lastQuery
5760

61+
initialized = true;
62+
5863
searchLogo.addEventListener('mousedown', (e) => {
5964
e.preventDefault()
6065
})
@@ -172,7 +177,7 @@ function Search(props) {
172177
}
173178
}
174179
})
175-
})
180+
}, [initialized])
176181

177182
if (props.inline) {
178183
return <div id="redis-sitesearch" className="redis-sitesearch redis-sitesearch-inline">

0 commit comments

Comments
 (0)