Closed Lehoczky closed 11 months ago
Heyo,
This is indeed an issue that cannot be resolved as it is how Nuxt runtime config works.
But your solution with providing functions as props to AlgoliaDocSearch seems like a very good idea!
Could you please create a PR with your proposed solution? I will review it in the upcoming days :)
Sure! I will try to find some time to do it this week
Version
@nuxtjs/algolia: latest nuxt: 3.6.5
Reproduction Link
This can be easily replicated in the module's playground. See steps below.
Steps to reproduce
From Nuxt's documentation:
Therefore non of the options that take functions are working right now if set from
nuxt.config.ts
. This includesdocsearch.transformItems
,docsearch.hitComponent
,docsearch.transformSearchClient
,docsearch.navigator
,docsearch.getMissingResultsUrl
. There might be others I missed.You can easily see that these are missing, if you bind the public runtime config to the DOM (or just
console.log()
it):What is Expected?
That the functions are working from the config, but since that is impossible, it would be better to remove these options and only allow them as component properties. Something like this:
This looks cleaner than using one object as a prop:
Setting the
apiKey
andapplicationId
should also be inherited from the config file, because it is more convenient to set those values there. Right now if we use the component'soption
property, we cannot use those values set in the config.Edit: I'm happy to work on this.