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

fix(connectToggle): use currentRefinement in metadata instead of the label #909

Merged
merged 1 commit into from
Jan 26, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Jan 26, 2018

Summary

Close partially #891

@samouss samouss requested a review from Haroenv January 26, 2018 16:57
@algobot
Copy link
Contributor

algobot commented Jan 26, 2018

Deploy preview for react-instantsearch ready!

Built with commit 38f4f44

https://deploy-preview-909--react-instantsearch.netlify.com

@@ -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({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really weird conditional pushing IMO

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which behaviour you will expect instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const items = checked ? [{..stuff}] : []

I'm not sure if it's that much better though

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep not sure, because the ternary will be split on several line.

if (checked) {
items.push({
label: props.label,
currentRefinement: props.label,
currentRefinement: checked,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense wrt that issue

@samouss samouss merged commit 89cae2b into master Jan 26, 2018
@samouss samouss deleted the fix/connect-toggle-metadata-current-refinement branch January 26, 2018 19:47
samouss added a commit that referenced this pull request Feb 6, 2018
<a name="4.5.0"></a>
# [4.5.0](v4.4.2...v4.5.0) (2018-02-06)

### Bug Fixes

* **connectRange:** use the same behaviour for currentRefinement in getMetadata ([#923](#923)) ([08917b6](08917b6))
* **connectToggle:** use currentRefinement in metadata instead of the label ([#909](#909)) ([89cae2b](89cae2b))
* **StarRatings:** always show the stars below ([#929](#929)) ([22bf93a](22bf93a))

### Features

* **connectStateResults:** expose isSearchStalled ([#933](#933)) ([f45ba27](f45ba27))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants