Skip to content

feat(autocomplete): default insights events#6976

Open
Haroenv wants to merge 2 commits intomasterfrom
feat/aaa-insights
Open

feat(autocomplete): default insights events#6976
Haroenv wants to merge 2 commits intomasterfrom
feat/aaa-insights

Conversation

@Haroenv
Copy link
Copy Markdown
Contributor

@Haroenv Haroenv commented Apr 15, 2026

Summary

adds default click events to autocomplete

Result

same sort of implementation as for hits, autocomplete has click events by default (if insights is enabled)

same sort of implementation as for hits
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 15, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 11 complexity · 14 duplication

Metric Results
Complexity 11
Duplication 14

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@6976

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@6976

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@6976

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@6976

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@6976

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@6976

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@6976

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@6976

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@6976

commit: 05f9eb0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds default Algolia Insights click tracking for Autocomplete items (similar to Hits) when Insights is enabled.

Changes:

  • Pass sendEvent from the Autocomplete connector down to the UI AutocompleteIndex component (React InstantSearch + InstantSearch.js).
  • Enrich Autocomplete connector hits with __position and __queryID so Insights events have the required metadata.
  • Add widget-level tests to assert default click + auxclick events are emitted and associated with the correct index.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/common/widgets/autocomplete/insights.tsx Adds integration-style tests asserting default Autocomplete Insights click behavior.
tests/common/widgets/autocomplete/index.ts Registers the new Autocomplete insights test suite in common widget tests.
packages/react-instantsearch/src/widgets/Autocomplete.tsx Threads sendEvent into AutocompleteIndex for React InstantSearch.
packages/instantsearch.js/src/widgets/autocomplete/autocomplete.tsx Threads sendEvent into AutocompleteIndex for InstantSearch.js widget wrapper.
packages/instantsearch.js/src/connectors/autocomplete/connectAutocomplete.ts Enriches connector hits with absolute positions and query IDs for Insights.
packages/instantsearch.js/src/connectors/autocomplete/tests/connectAutocomplete-test.ts Updates connector tests to reflect enriched hits and correct 1-based positions.
packages/instantsearch-ui-components/src/components/autocomplete/AutocompleteIndex.tsx Adds default click/auxclick handlers that emit internal Insights click events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Haroenv Haroenv marked this pull request as ready for review April 15, 2026 12:51
@Haroenv Haroenv requested review from a team, FabienMotte and shaejaz and removed request for a team April 15, 2026 12:52
...requests.map(
({ indexName }: Parameters<SearchClient['search']>[0][number]) =>
createSingleSearchResponse({
index: indexName,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add queryID and assert it below in the 3 tests?

Comment thread bundlesize.config.json
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.

3 participants