Skip to content

Conversation

@JaosnHsieh
Copy link

@JaosnHsieh JaosnHsieh commented Oct 14, 2018

Griddle major version

1.13.1

Changes proposed in this pull request

Wish could have props.Children is and array of at the same time.

Why these changes are made

#836

Are there tests?

One story added as test

Copy link
Contributor

@dahlbyk dahlbyk left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution! Could you add an example of this feature to the Storybook to confirm it works as expected?

previous[current.props.id] = {order: offset + i, ...current.props};
if(Array.isArray(current)){
current.forEach((c)=>{
previous[c.props.id] = {order: offset + i, ...c.props};
Copy link
Contributor

Choose a reason for hiding this comment

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

This will end up producing multiple columns that share an order value, which can produce unexpected behavior.

// Working against an array of columnProperties
if (Array.isArray(children)) {
// build one object that contains all of the column properties keyed by id
children.reduce((previous, current, i) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would a simpler solution be to _.flatten(children).reduce(...) here?

Copy link
Author

Choose a reason for hiding this comment

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

it's better!

@JaosnHsieh
Copy link
Author

JaosnHsieh commented Dec 21, 2018

just updated to current version and added sotrybook example

@JaosnHsieh JaosnHsieh force-pushed the fix/836_columnDefIsArray branch from 0a4bd1b to 00f3f79 Compare January 21, 2019 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants