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(sendEvent): split > 20 objects in multiple calls #4841

Merged
merged 2 commits into from
Aug 24, 2021

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Aug 19, 2021

Summary

the backend api doesn't allow > 20 hits per event, so we split the sendEvent calls up into multiple if > 20 DX-2379

Result

edited sendEvent and bindEvent to both split up the vents in arrays where it makes sense, and calling sendEvent multiple times.

We choose to split at this level and not inside the events listener, as you can't know what method is used, and you'd need a lot of conditional code to handle all chunking

Verified

This commit was signed with the committer’s verified signature.
wmouchere William Mouchère
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 19, 2021

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 0fb7d86:

Sandbox Source
InstantSearch.js Configuration

Verified

This commit was signed with the committer’s verified signature.
wmouchere William Mouchère
@Haroenv Haroenv requested review from a team, eunjae-lee and francoischalifour and removed request for a team August 23, 2021 09:57
@Haroenv Haroenv marked this pull request as ready for review August 23, 2021 09:57
Copy link
Contributor

@eunjae-lee eunjae-lee left a comment

Choose a reason for hiding this comment

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

For me and others viewing this in the future, there are some constraints that force us to call sendEvent multiple times:

  1. insightsClient() takes only a single event (search-insights.js has to support it first.)
  2. onEvent hook in the insights middleware receives a single event.

I guess we should've seen this coming and had plural events in the code from the beginning.

@Haroenv Haroenv merged commit 44574bc into master Aug 24, 2021
@Haroenv Haroenv deleted the fix/send-event-over-20 branch August 24, 2021 08:00
@JessycaFrederick
Copy link

I'm still experiencing this problem. I'm using InstantSearch.js v 4.43.1. Please let me know what other information you need.

@Haroenv
Copy link
Contributor Author

Haroenv commented Sep 5, 2022

@JessycaFrederick do you have a reproduction somewhere? Could you open a new issue with that? We have a sandbox you can start with here. Thanks!

@JessycaFrederick
Copy link

Thanks @Haroenv ... it turns out I wasn't using the latest version of InstantSearch.js and I was confused by the naming conventions. Also, I copied the script from the docs which were out of date. I believe support has taken care of it and I'm no longer getting the errors.

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