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

fix: recompute row heights when new items are appended to DataList #116

Merged
merged 1 commit into from
Nov 6, 2020

Conversation

schottra
Copy link
Contributor

@schottra schottra commented Nov 6, 2020

TL;DR

When the last item in the list is larger than the default row size, appending more items to the list will cause the next item to bleed into the previously last item. This is because react-virtualized has the wrong value for the height of the row and hasn't been told to recompute it.

Note: There is no accompanying test for this change because testing the DataList component is prohibitively difficult due to the use of CellMeasurer and Autosizer from the react-virtualized package. I manually verified the fix.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

When starting with a list of length n, the item at row index n+1 is our "load more" row. We use a CellMeasurerCache to keep track of the heights of each row, and allow react-virtualized to computer the heights using a CellMeasurer. The starting height of the last row will be the height of our "load more" row. When we append more items, the first item in the newly-appended list will not be measured because we already have a height for it (previously computed using the "load more" row). To account for this, we are now using a layout effect that fires when the list length changes, and will force a recompute for the first item in the newly appended list if our list length is increasing.

Tracking Issue

flyteorg/flyte#507

Follow-up issue

NA

@schottra schottra merged commit 04d456b into master Nov 6, 2020
@schottra schottra deleted the fix-load-more-layout-issue branch November 6, 2020 17:31
@service-github-lyft-semantic-release
Copy link
Contributor

🎉 This PR is included in version 0.17.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants