Skip to content

Fix flow error due to incorrectly set defaultProps #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2020
Merged

Fix flow error due to incorrectly set defaultProps #1138

merged 1 commit into from
Feb 25, 2020

Conversation

mbhrznr
Copy link
Contributor

@mbhrznr mbhrznr commented Feb 7, 2020

#1137

a simple fix for the issue i created.
sets the containerPadding within defaultProps to the expected value.

@STRML
Copy link
Collaborator

STRML commented Feb 25, 2020

Interestingly, I'm not getting this Flow error, but it should show up.

Edit: Getting it when included in other packages... investigating.

@STRML STRML merged commit 91ebd58 into react-grid-layout:master Feb 25, 2020
@STRML
Copy link
Collaborator

STRML commented Feb 25, 2020

Surfaced the error in 0e38ea0 and used that as an opportunity to fix up the props defs.

n1ghtmare pushed a commit to n1ghtmare/react-grid-layout that referenced this pull request Feb 26, 2020
This made the bug described in react-grid-layout#1137/react-grid-layout#1138 visible by adding typing
to examples, ensuring that we're using RGL and RRGL as well as the
WidthProvider HOC in actual code, so Flow covers it completely.
@STRML
Copy link
Collaborator

STRML commented Sep 3, 2020

This actually creates a behavioral difference as null containerPadding causes <ReactGridLayout> to use margin, so it would be [10, 10], not [0, 0]. Reverting in 0.18.4.

STRML added a commit that referenced this pull request Sep 3, 2020
This inadvertently caused containerPadding to default to [0, 0] on
default ResponsiveReactGridLayouts, not to the value of `margin`.

This restores the previous behavior and fixes types.

Prettier seems to have a bug and attempts to line-wrap the typedef in
ResponsiveReactGridLayout#L59, breaking the type, so I added an ignore.
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