Browse Source

Fix preconnect link to target search cluster (#3980)

The `appId` was retrieved from props but the `<Search>` component is never instantiated with props. So the preconnect link targeted an unknown search cluster:

```html
<link rel="preconnect" href="https://undefined-dsn.algolia.net" crossorigin="true">
```

This fixes the preconnect link by getting the `appId` from the website config.
main
François Chalifour 3 years ago
committed by Dan Abramov
parent
commit
faeaf22fd1
  1. 3
      beta/src/components/Search.tsx

3
beta/src/components/Search.tsx

@ -46,7 +46,6 @@ const options = {
};
let DocSearchModal: any = null;
export const Search: React.FC<SearchProps> = ({
appId,
searchParameters = {
hitsPerPage: 5,
},
@ -93,7 +92,7 @@ export const Search: React.FC<SearchProps> = ({
<Head>
<link
rel="preconnect"
href={`https://${appId}-dsn.algolia.net`}
href={`https://${options.appId}-dsn.algolia.net`}
crossOrigin="true"
/>
</Head>

Loading…
Cancel
Save