Skip to content

Commit

Permalink
fix(theme): vitepress data not properly injected in app when use loca…
Browse files Browse the repository at this point in the history
…lSearch (#2299)
  • Loading branch information
zRains committed Apr 27, 2023
1 parent 1610b88 commit 69c7646
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client/theme-default/components/VPLocalSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { pathToFile } from '../../app/utils'
import { slash } from '../../shared'
import { useData } from '../composables/data'
import { createTranslate } from '../support/translation'
import { dataSymbol } from '../../app/data'
defineProps<{
placeholder: string
Expand Down Expand Up @@ -62,8 +63,8 @@ interface Result {
text?: string
}
const { localeIndex, theme } = useData()
const vitePressData = useData()
const { localeIndex, theme } = vitePressData
const searchIndex = computedAsync(async () =>
markRaw(
MiniSearch.loadJSON<Result>(
Expand Down Expand Up @@ -153,6 +154,7 @@ debouncedWatch(
const app = createApp(comp)
// Silence warnings about missing components
app.config.warnHandler = () => {}
app.provide(dataSymbol, vitePressData)
const div = document.createElement('div')
app.mount(div)
const sections = div.innerHTML.split(headingRegex)
Expand Down

0 comments on commit 69c7646

Please sign in to comment.