-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(createAlgoliaInsightsPlugin): automatically load Insights when not passed #1106
Conversation
positions?: number[]; | ||
}; | ||
|
||
type QueueItemMap = Record<string, unknown>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be more strictly typed, but it requires updating TypeScript, which then triggers other type issues.
Let's handle this in another PR.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6a51c83:
|
script.onerror = () => { | ||
// eslint-disable-next-line no-console | ||
console.error(errorMessage); | ||
}; | ||
|
||
document.body.appendChild(script); | ||
} catch (cause) { | ||
// eslint-disable-next-line no-console | ||
console.error(errorMessage); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of using console.error
s but since there's no global error handler in Autocomplete, throwing would be hardly catchable for users.
I'd rather use those now (Sentry lets you catch calls to the Console API) and work on an onError
handler in a separate PR to centralize error handling.
This automatically loads the Insights library when using the Insights plugin without passing a client.
The
insightsClient
parameter is now optional, allowing us to later initialize the plugin internally without a client if we can't find one on the page.FX-2245