Skip to content
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

new(responsive): add ignoreDimensions prop to handle rerenders #834

Merged
merged 4 commits into from
Oct 7, 2020

Conversation

wyze
Copy link
Contributor

@wyze wyze commented Oct 2, 2020

🚀 Enhancements

This PR

  • add a new prop to ParentSize (disableFor) to skip when a component doesn't want to be notified by a size change of a certain prop
  • also converted the class component to a functional component (hopefully was ok). I did that in a separate commit so you could see what was needed for the feature

Note: I did attempt a test and was unsuccessful, so more than happy to add one provided some direction. I use react-testing-library, so unsure how to simulate resize of an element with enzyme.

Also, disableFor might not be the best name for the prop, so I am open to changing it.

Close #247

@coveralls
Copy link

coveralls commented Oct 2, 2020

Pull Request Test Coverage Report for Build 293585828

  • 0 of 21 (0.0%) changed or added relevant lines in 1 file are covered.
  • 18 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+1.3%) to 56.572%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/visx-responsive/src/components/ParentSize.tsx 0 21 0.0%
Files with Coverage Reduction New Missed Lines %
packages/visx-pattern/src/patterns/Lines.tsx 1 85.0%
packages/visx-xychart/src/components/XYChart.tsx 2 92.5%
packages/visx-responsive/src/enhancers/withParentSize.tsx 5 58.06%
packages/visx-xychart/src/components/series/BarSeries.tsx 5 58.44%
packages/visx-xychart/src/components/series/LineSeries.tsx 5 41.38%
Totals Coverage Status
Change from base Build 283122090: 1.3%
Covered Lines: 1250
Relevant Lines: 2133

💛 - Coveralls

Copy link
Collaborator

@williaster williaster 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 the addition @wyze, and the FunctionComponent refactor! 💯

I had a couple of small suggestions but otherwise lgtm. I think for now don't worry about new tests, mocking these things in enzyme isn't super easy / I can add the boilerplate later.

packages/visx-responsive/src/components/ParentSize.tsx Outdated Show resolved Hide resolved
packages/visx-responsive/src/components/ParentSize.tsx Outdated Show resolved Hide resolved
packages/visx-responsive/src/components/ParentSize.tsx Outdated Show resolved Hide resolved
wyze and others added 2 commits October 7, 2020 09:06
Co-authored-by: Chris Williams <williaster@users.noreply.github.com>
@wyze wyze changed the title new(responsive): add disableFor prop to handle rerenders new(responsive): add ignoreDimensions prop to handle rerenders Oct 7, 2020
Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for the addition @wyze!

@williaster williaster merged commit e6abc6b into airbnb:master Oct 7, 2020
@wyze wyze deleted the parentsize-updates branch October 7, 2020 18:55
@williaster williaster added this to the 1.1.0 milestone Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ParentSize disableHieght disableWidth
4 participants