Skip to content

Commit

Permalink
Fix preconnect link to target search cluster (#3980)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
francoischalifour authored and gaearon committed Oct 28, 2021
1 parent e75356d commit faeaf22
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions beta/src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const options = {
};
let DocSearchModal: any = null;
export const Search: React.FC<SearchProps> = ({
appId,
searchParameters = {
hitsPerPage: 5,
},
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit faeaf22

Please sign in to comment.