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

fix(List): render children list only when required #1472

Merged
merged 3 commits into from
Aug 7, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Aug 6, 2018

Summary

This PR is a followup of #1459. It adds tests to the List component (only for the changes not the all component). Now we render the children list only when the item contains an non empty array of items. The same condition is applied on the class item--parent.

Before

screen shot 2018-08-06 at 14 25 23

After

screen shot 2018-08-06 at 14 25 45

Note: The arrow is not present on the latter since we removed the class.

@samouss samouss requested a review from Haroenv August 6, 2018 13:22
@algobot
Copy link
Contributor

algobot commented Aug 6, 2018

Deploy preview for react-instantsearch ready!

Built with commit d455524

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

.map(child => this.renderItem(child, item))}
</ul>
);
const isItemHasChildren = item.items && Boolean(item.items.length);
Copy link
Contributor

Choose a reason for hiding this comment

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

hasChildren should be clear enough too right? This name now is pretty unclear :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed. But I prefer to be explicit with something like itemHasChildren. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

itemHasChildren also would be fine :)

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

LGTM

@samouss samouss force-pushed the fix/list-empty-children branch from 8e90e7b to d455524 Compare August 7, 2018 08:56
@samouss samouss merged commit 9eb2cbb into master Aug 7, 2018
@samouss samouss deleted the fix/list-empty-children branch August 7, 2018 09:31
samouss added a commit that referenced this pull request Aug 16, 2018
<a name="5.2.3"></a>
## [5.2.3](v5.2.2...v5.2.3) (2018-08-16)

### Bug Fixes

* Allow object as type for Root (closes [#1446](#1446)) ([#1461](#1461)) ([7c2317b](7c2317b))
* **List:** render children list only when required ([#1472](#1472)) ([9eb2cbb](9eb2cbb)), closes [#1459](#1459)
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.

4 participants