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): fix the regression that it didn't send events with instantsearch.insights() #4519
Conversation
…tantsearch.insights()
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 1812da7:
|
src/lib/insights/listener.tsx
Outdated
} else { | ||
} | ||
|
||
{ |
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.
prop.sendEvent
exists, so it always followed the first if branch. We should run them both.
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.
if we should run them both, you should probably remove the curly brace here and on line 72
src/lib/insights/listener.tsx
Outdated
} else { | ||
} | ||
|
||
{ |
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.
if we should run them both, you should probably remove the curly brace here and on line 72
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.
Why don't we cover this regression with a test?
Summary
This PR fixes the regression introduced since 4.8.0 where InstantSearch didn't send Insights events implemented with
instantsearch.insights()
inhits
orinfiniteHits
widgets.Result
It sends events now.
Test
If you run this example ->, it will correctly send events when you click buttons. However if you change the version of InstantSearch to 4.8.0, it won't any more.