Skip to content

Commit

Permalink
feat: remove preconnect link tag since initialization is always deferred
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhu2000 committed Jul 17, 2024
1 parent 0b4a864 commit 085a6b9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ You can pass the following props to the `LiveChatLoaderProvider` provider:
- `idlePeriod`: How long to wait in ms before loading the provider. Default is
`2000`. Set to `0` to never load. This value is used in a `setTimeout` in
browsers that don't support `requestIdleCallback`.
- `preconnect`: Determines whether a `link` tag with `rel=preconnect` is created. Default is `true`.
- `beforeInit`: A function to be called after the script has loaded, but before the chat provider has been initialized (optional)
- `onReady`: A function to be called once the script has been loaded, the chat provider has been initialized and is ready for use (optional)

Expand Down
14 changes: 0 additions & 14 deletions src/components/LiveChatLoaderProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ interface LiveChatLoaderProps {
provider: Provider
children: React.ReactNode
idlePeriod?: number
/**
* determines whether to create a link tag that preconnect to the chat provider's domain
*
* @default true
*/
preconnect?: boolean
providerKey: string
appID?: string
baseUrl?: string
Expand All @@ -26,7 +20,6 @@ export const LiveChatLoaderProvider = ({
provider,
children,
idlePeriod = 5000,
preconnect = true,
baseUrl,
...props
}: LiveChatLoaderProps): JSX.Element | null => {
Expand All @@ -52,13 +45,6 @@ export const LiveChatLoaderProvider = ({

return (
<LiveChatLoaderContext.Provider value={value}>
{preconnect && (
<link
href={baseUrl || chatProvider.domain}
rel="preconnect"
crossOrigin=""
/>
)}
{children}
</LiveChatLoaderContext.Provider>
)
Expand Down

0 comments on commit 085a6b9

Please sign in to comment.