Skip to content

Commit

Permalink
fix(insights): fix the regression that it didn't send events with ins…
Browse files Browse the repository at this point in the history
…tantsearch.insights() (#4519)

* fix(insights): fix the regression that it didn't send events with instantsearch.insights()

* remove unnecessary curly brace
  • Loading branch information
Eunjae Lee committed Sep 22, 2020
1 parent d5526a0 commit 10e38df
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/lib/insights/listener.tsx
Expand Up @@ -58,17 +58,17 @@ const insightsListener = (BaseComponent: any) => {
const payload = parseInsightsEvent(targetWithEvent);
props.sendEvent(payload);
}
} else {
// old way, e.g. instantsearch.insights("clickedObjectIDsAfterSearch", { .. })
const insightsTarget = findInsightsTarget(
event.target as HTMLElement | null,
event.currentTarget as HTMLElement | null,
element => hasDataAttributes(element)
);
if (insightsTarget) {
const { method, payload } = readDataAttributes(insightsTarget);
props.insights(method, payload);
}
}

// old way, e.g. instantsearch.insights("clickedObjectIDsAfterSearch", { .. })
const insightsTarget = findInsightsTarget(
event.target as HTMLElement | null,
event.currentTarget as HTMLElement | null,
element => hasDataAttributes(element)
);
if (insightsTarget) {
const { method, payload } = readDataAttributes(insightsTarget);
props.insights(method, payload);
}
};

Expand Down

0 comments on commit 10e38df

Please sign in to comment.