-
Notifications
You must be signed in to change notification settings - Fork 1.1k
reactivate language support or vue router next #3967
Conversation
I'm putting this up already to make it faster later on update. This needs to wait for vuejs/vitepress#283 to be released and used by vue router next |
hey @posva, should it be merged now? |
Not yet! I will ping you this week once we release the fix on vitepress. Thank you 🙏 |
@shortcuts The new docs have been deployed with the proper |
@shortcuts Thank you! This is the visual effect when searching after switching languages: (notice the second algolia search under the first one) |
Hi @posva, I'm not able to reproduce the issue on your website, has it been solved? We don't provide any way (with JS) to destroy/update the instance, but I'll keep that in mind and try to expose an A way to solve that would be to create a ref to always keep the
and pass |
The problem still exists:
In our code we have an update function that removes the HTML (which removes the event listeners attached to the removed HTML) but leaves out the cmd + k listener which adds a new modal anyway: I don't understand how you could pass the reference to facetFilters apart from mutating an array but this looks extremely fragile const facetFilters = [...]
docsearch(
Object.assign({}, userOptions, {
container: '#docsearch',
searchParameters: Object.assign({}, userOptions.searchParameters, {
// pass a custom lang facetFilter to allow multiple language search
// https://github.com/algolia/docsearch-configs/pull/3942
facetFilters: facetFilters.concat(
userOptions.searchParameters?.facetFilters || []
)
}), (I tested it and it works nicely but looks more like a workaround than anything and I'm afraid this could break anytime) Sometimes we need to unmount the component containing the algolia search and it would be safe to have a destroy/cleanup method from docsearch to remove all event listeners. This will also ensure things work with HMR and any other situation (it's also normal for JS libraries to expose a destroy method to cleanup all of its event listeners) |
This is indeed something that we should provide before the official release of the v3, thanks for the feedback! Mutating the array seems like a good workaround in the meantime. In case this is something pressing on your side, feel free to open a pull request for a |
Workaround until a destroy method is added More at algolia/docsearch-configs#3967 (comment)
Thanks, this is not really pressing as it still works and is an edge case. But I might give that |
Pull request motivation(s)
What is the current behaviour?
If the current behaviour is a bug, please provide all the steps to reproduce and screenshots with context.
What is the expected behaviour?
NB: Do you want to request a feature or report a bug?
NB2: Any other feedback / questions ?