Skip to content
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

Merged
merged 3 commits into from
Oct 25, 2023

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Oct 24, 2023

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.

@@ -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}`,
Copy link
Member Author

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?

Copy link
Member

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.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 24, 2023

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:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration

@@ -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}`,
Copy link
Member

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.

@sarahdayan sarahdayan merged commit 256223a into feat/dashboard-insights Oct 25, 2023
9 checks passed
@sarahdayan sarahdayan deleted the fix/dashboard-insights-source branch October 25, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants