Skip to content

Commit

Permalink
fix(theme-default): remove duplicate judgments in preconnect() (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
manchan4869 authored Feb 7, 2023
1 parent 616fe5b commit 48c9b11
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/client/theme-default/components/VPNavBarSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,20 @@ const preconnect = () => {
const rIC = window.requestIdleCallback || setTimeout
rIC(() => {
if (!theme.value.algolia || document.head.querySelector(`#${id}`)) return
const preconnect = document.createElement('link')
preconnect.id = id
preconnect.rel = 'preconnect'
preconnect.href = `https://${theme.value.algolia.appId}-dsn.algolia.net`
preconnect.href = `https://${theme.value.algolia!.appId}-dsn.algolia.net`
preconnect.crossOrigin = ''
document.head.appendChild(preconnect)
})
}
}
onMounted(() => {
if (!theme.value.algolia) {
return
}
preconnect()
// meta key detect (same logic as in @docsearch/js)
Expand Down

0 comments on commit 48c9b11

Please sign in to comment.