File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
docusaurus/src/theme/SearchBar Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ function SearchBarContent() {
157157 import ( 'meilisearch-docsearch' ) ,
158158 import ( 'meilisearch-docsearch/css' )
159159 ] ) . then ( ( [ { docsearch } ] ) => {
160- const search = docsearch ( {
160+ const baseOptions = {
161161 container : searchButtonRef . current ,
162162 host : siteConfig . customFields . meilisearch . host ,
163163 apiKey : siteConfig . customFields . meilisearch . apiKey ,
@@ -241,7 +241,19 @@ function SearchBarContent() {
241241 getMissingResultsUrl : ( { query } ) => {
242242 return `https://github.com/strapi/documentation/issues/new?title=Missing+search+results+for+${ query } ` ;
243243 } ,
244- } ) ;
244+ } ;
245+
246+ // Prefer official header wiring if library supports it
247+ if ( userId ) {
248+ // Some versions accept requestConfig.headers, others accept headers; set both safely
249+ baseOptions . requestConfig = {
250+ ...( baseOptions . requestConfig || { } ) ,
251+ headers : { 'X-MS-USER-ID' : userId }
252+ } ;
253+ baseOptions . headers = { ...( baseOptions . headers || { } ) , 'X-MS-USER-ID' : userId } ;
254+ }
255+
256+ const search = docsearch ( baseOptions ) ;
245257
246258 searchInstanceRef . current = search ;
247259 setIsLoaded ( true ) ;
You can’t perform that action at this time.
0 commit comments