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

Grid: Allow users to opt out of rerendering on scroll stop #1131

Merged
merged 4 commits into from
Jun 13, 2018
Merged

Grid: Allow users to opt out of rerendering on scroll stop #1131

merged 4 commits into from
Jun 13, 2018

Conversation

wuweiweiwu
Copy link
Contributor

@wuweiweiwu wuweiweiwu commented Jun 5, 2018

closes: #1028

Added isScrollingOptOut that prevents re-rendering on scroll end.

Cells always rerender on scroll end because the cell cache is cleared. Thus if this prop is specified, the visible cells in the cache are not cleared (to keep the cell cache to a manageable size) and thus can be used in defaultCellRangeRender.

  • add docs for Grid
  • add tests for isScrollingOptOut

Copy link
Contributor

@aem aem left a comment

Choose a reason for hiding this comment

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

🔥

@@ -1905,6 +1905,52 @@ describe('Grid', () => {
expect(cellRendererCalls.length).not.toEqual(0);
});

it('should not clear cache if :isScrollingOptOut is true', () => {
const cellRendererCalls = [];
function cellRenderer({columnIndex, key, rowIndex, style}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

as more people start to push perf it might make sense to make some test utils to do things like track render calls rather than a bespoke function in each test. looks great for this issue, but maybe open an issue for that? it's something i may have some time to tackle next week

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I'll open an issue.

@wuweiweiwu wuweiweiwu merged commit 438b567 into bvaughn:master Jun 13, 2018
@nihgwu
Copy link
Contributor

nihgwu commented Jun 14, 2018

the current approach is tricky, if we user custom cellRangeRenderer, we probably omit that opt out, I'd suggest we can simply pass isScrolling = undefined when calling cellRangeRenderer if isScrollingOptOut is true, BTW I prefer the term usingIsScrolling from react-window

@wuweiweiwu
Copy link
Contributor Author

@nihgwu Do you mind opening an issue for that? I like the idea of passing isScrolling = false when calling cellRangeRenderer

and that propName makes more sense as well.

It'll be better tracking for me. Thanks!

@nihgwu
Copy link
Contributor

nihgwu commented Jun 14, 2018

isScrolling to be undefined would be much better as false would lead wrong usage on user land

@wuweiweiwu
Copy link
Contributor Author

I see. I'd prefer something other than undefined though.

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.

Add option to not re-render list rows when scrolling
3 participants