Skip to content

Commit 48c9b11

Browse files
authored
fix(theme-default): remove duplicate judgments in preconnect() (#1903)
1 parent 616fe5b commit 48c9b11

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/client/theme-default/components/VPNavBarSearch.vue

+3-5
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,20 @@ const preconnect = () => {
3434
3535
const rIC = window.requestIdleCallback || setTimeout
3636
rIC(() => {
37-
if (!theme.value.algolia || document.head.querySelector(`#${id}`)) return
38-
3937
const preconnect = document.createElement('link')
4038
preconnect.id = id
4139
preconnect.rel = 'preconnect'
42-
preconnect.href = `https://${theme.value.algolia.appId}-dsn.algolia.net`
40+
preconnect.href = `https://${theme.value.algolia!.appId}-dsn.algolia.net`
4341
preconnect.crossOrigin = ''
4442
document.head.appendChild(preconnect)
4543
})
46-
}
44+
}
4745
4846
onMounted(() => {
4947
if (!theme.value.algolia) {
5048
return
5149
}
52-
50+
5351
preconnect()
5452
5553
// meta key detect (same logic as in @docsearch/js)

0 commit comments

Comments
 (0)