emersonbottero / vitepress-plugin-search

Provide local search to your documentation site.
MIT License
238 stars 30 forks source link

bug: broken support for vitepress@1.0.0-alpha.38 #43

Closed Raiondesu closed 1 year ago

Raiondesu commented 1 year ago

Description

Seach bar seems to either unexpectedly disappear, fill console with cannot read ... of undefined errors or redirect to blank pages after searching for something.

Reproduction

https://github.com/Raiondesu/vuse-rx/tree/feature/search https://vuse-rx-git-feature-search-raiondesu.vercel.app

Hypothesis

VitePress seems to have accidentally made a breaking change in this commit, which causes vitepress-plugin-search to misbehave when using a version of VitePress that includes the aforementioned commit.

Proposed fix

Change

const { localePath } = useData();
...
origin.value = window.location.origin + localePath.value;

to

const { localeIndex } = useData();
...
origin.value = window.location.origin + localeIndex.value;

in Search.vue