-
Notifications
You must be signed in to change notification settings - Fork 326
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
fix(insights): declare automatic source #1213
fix(insights): declare automatic source #1213
Conversation
@@ -197,7 +197,7 @@ describe('createAutocomplete', () => { | |||
createMultiSearchResponse<{ label: string }>( | |||
...requests.map(({ indexName, query = '' }, index) => ({ | |||
hits: Array.from({ length: 2 }).map((_, i, arr) => ({ | |||
objectID: String(index * arr.length + i + 1), | |||
objectID: `${String(index * arr.length + i + 1)}-${query}`, |
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.
No events were sent in response to typing "a" before this, maybe due to a caching mechanism?
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.
That's because openOnFocus=true
, so the event was probably sent as the search was focused and since the results didn't change with the "a" query, we don't send them another time.
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 0b2dfbf:
|
packages/autocomplete-plugin-algolia-insights/src/createAlgoliaInsightsPlugin.ts
Outdated
Show resolved
Hide resolved
@@ -197,7 +197,7 @@ describe('createAutocomplete', () => { | |||
createMultiSearchResponse<{ label: string }>( | |||
...requests.map(({ indexName, query = '' }, index) => ({ | |||
hits: Array.from({ length: 2 }).map((_, i, arr) => ({ | |||
objectID: String(index * arr.length + i + 1), | |||
objectID: `${String(index * arr.length + i + 1)}-${query}`, |
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.
That's because openOnFocus=true
, so the event was probably sent as the search was focused and since the results didn't change with the "a" query, we don't send them another time.
Summary
This PR (similar to algolia/instantsearch#5901 for InstantSearch) adds an entry in the
algoliaSource
payload data sent with events, to declare when they are sent from an Insights plugin initialized from the dashboard.