Skip to content

Commit cd64bcf

Browse files
tkruggfrancoischalifour
authored andcommitted
fix(currentRefinements): don't rely on _objectSpread (#3672)
The `_objectSpread` polyfill calls `Object.keys()` under the hood which does not support anything other than objects on IE11.
1 parent 6ddcfb6 commit cd64bcf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/connectors/current-refinements/connectCurrentRefinements.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,23 @@ function normalizeRefinement(refinement) {
254254
? `${getOperatorSymbol(refinement.operator)} ${refinement.name}`
255255
: refinement.name;
256256

257-
return {
257+
const normalizedRefinement = {
258258
attribute: refinement.attributeName,
259259
type: refinement.type,
260260
value,
261261
label,
262-
...(refinement.operator !== undefined && { operator: refinement.operator }),
263-
...(refinement.count !== undefined && { count: refinement.count }),
264-
...(refinement.exhaustive !== undefined && {
265-
exhaustive: refinement.exhaustive,
266-
}),
267262
};
263+
264+
if (refinement.operator !== undefined) {
265+
normalizedRefinement.operator = refinement.operator;
266+
}
267+
if (refinement.count !== undefined) {
268+
normalizedRefinement.count = refinement.count;
269+
}
270+
if (refinement.exhaustive !== undefined) {
271+
normalizedRefinement.exhaustive = refinement.exhaustive;
272+
}
273+
return normalizedRefinement;
268274
}
269275

270276
function groupItemsByRefinements(items, helper) {

0 commit comments

Comments
 (0)