Skip to content

Commit bc8f643

Browse files
authored
refactor(sendEvent): simplify code (#5526)
We are splitting all events in batches of 20, so __escaped is already removed from the hits. This is already covered by existing tests.
1 parent cfeabda commit bc8f643

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

packages/instantsearch.js/src/lib/utils/createSendEventForHits.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ const buildPayloads = ({
7373
return [];
7474
}
7575
}
76-
const hitsArray: Hit[] = Array.isArray(hits)
77-
? removeEscapedFromHits(hits)
78-
: [hits];
76+
const hitsArray: Hit[] = Array.isArray(hits) ? hits : [hits];
7977

8078
if (hitsArray.length === 0) {
8179
return [];
@@ -146,11 +144,6 @@ const buildPayloads = ({
146144
}
147145
};
148146

149-
function removeEscapedFromHits(hits: Hit[] | EscapedHits): Hit[] {
150-
// remove `hits.__escaped` without mutating
151-
return hits.slice();
152-
}
153-
154147
export function createSendEventForHits({
155148
instantSearchInstance,
156149
index,

0 commit comments

Comments
 (0)