-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support router.go for same page navigations #4461
Comments
Ah, the router actually doesn't support same page navigations. You can do something like this in your SearchInput component: vitepress/src/client/theme-default/components/VPAlgoliaSearchBox.vue Lines 54 to 65 in c61182a
Although it does change the visible URL, useUrlSearchParams cannot track those updates. |
Thank you for your prompt response. I will try to adopt your suggestions to temporarily solve my problem and continue to monitor this issue. |
This will be supported in next v2-alpha release. You can probably continue to use the location.assign hack till v2 gets beta or stable. vueuse's const route = useRoute();
const results = computed(() => {
const params = Object.fromEntries(new URLSearchParams(route.query));
return params.char
? data.filter((word) =>
word.toLowerCase().includes(params.char.toLowerCase())
)
: ['NO_RESULTS'];
}); https://stackblitz.com/edit/vite-9afg8su7?file=docs/components/ResultsList.vue |
Describe the bug
I try to make a search box that would navigate to search results page with some search params after clicking "search" button, it works fine in dev mode, but can't work on search results page in build mode.
Reproduction
A online demo is available here.
npm run docs:dev
in terminal.npm run docs:build
andnpm run docs:preview
.Expected behavior
Build mode should have the same performance as dev mode. On search results page, page should refresh and apply new query params to filter results.
System Info
Additional context
There is a related report here #813, but I don't think the problem I encountered is related to switching layouts, because my problem is shown on the same page in different modes.
Validations
The text was updated successfully, but these errors were encountered: