Skip to content

Commit

Permalink
fix(currentRefinements): don't rely on _objectSpread (#3672)
Browse files Browse the repository at this point in the history
The `_objectSpread` polyfill calls `Object.keys()` under the hood which does not support anything other than objects on IE11.
  • Loading branch information
tkrugg authored and francoischalifour committed Apr 11, 2019
1 parent 6ddcfb6 commit cd64bcf
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/connectors/current-refinements/connectCurrentRefinements.js
Expand Up @@ -254,17 +254,23 @@ function normalizeRefinement(refinement) {
? `${getOperatorSymbol(refinement.operator)} ${refinement.name}`
: refinement.name;

return {
const normalizedRefinement = {
attribute: refinement.attributeName,
type: refinement.type,
value,
label,
...(refinement.operator !== undefined && { operator: refinement.operator }),
...(refinement.count !== undefined && { count: refinement.count }),
...(refinement.exhaustive !== undefined && {
exhaustive: refinement.exhaustive,
}),
};

if (refinement.operator !== undefined) {
normalizedRefinement.operator = refinement.operator;
}
if (refinement.count !== undefined) {
normalizedRefinement.count = refinement.count;
}
if (refinement.exhaustive !== undefined) {
normalizedRefinement.exhaustive = refinement.exhaustive;
}
return normalizedRefinement;
}

function groupItemsByRefinements(items, helper) {
Expand Down

0 comments on commit cd64bcf

Please sign in to comment.