Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(connectToggle): use currentRefinement in metadata instead of the …
Browse files Browse the repository at this point in the history
…label (#909)
  • Loading branch information
samouss authored Jan 26, 2018
1 parent 9a8a154 commit 89cae2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/react-instantsearch/src/connectors/connectToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ export default createConnector({
const checked = getCurrentRefinement(props, searchState, this.context);
const items = [];
const index = getIndex(this.context);

if (checked) {
items.push({
label: props.label,
currentRefinement: props.label,
currentRefinement: checked,
attributeName: props.attributeName,
value: nextState => refine(props, nextState, false, this.context),
});
}

return { id, index, items };
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('connectToggle', () => {
// Ignore clear, we test it later
value: metadata.items[0].value,
attributeName: 't',
currentRefinement: 'yep',
currentRefinement: true,
},
],
id: 't',
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('connectToggle', () => {
// Ignore clear, we test it later
value: metadata.items[0].value,
attributeName: 't',
currentRefinement: 'yep',
currentRefinement: true,
},
],
id: 't',
Expand Down

0 comments on commit 89cae2b

Please sign in to comment.