-
-
Notifications
You must be signed in to change notification settings - Fork 794
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
add shouldForceUpdate to resetAfterIndex #32
Conversation
</p> | ||
<p> | ||
You can set <code>shouldForceUpdate</code> to <code>false</code> | ||
to prevent the list calling <code>forceUpdate</code> internally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is enough of an explanation. Maybe something more like:
By default the grid will automatically re-render after the index is reset. If you would like to delay this re-render until e.g. a state update has completed in the parent component, specify a value of
false
for the second, optional parameter.
(And similar for the below blocks.)
src/__tests__/VariableSizeGrid.js
Outdated
rowIndex: 15, | ||
shouldForceUpdate: false, | ||
}); | ||
expect(rendered.getInstance().forceUpdate).toHaveBeenCalledTimes(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way the "should recalculate the estimated total size" test checks for this is a bit more robust. (It checks to see if the columnWidth
or rowHeight
getter functions have been called.)
forceUpdate
is kind of an implementation detail (e.g. maybe the grid re-renders using setState
instead?)
Thanks for the PR! Requested some minor changes. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
// The estimated total width should be (200 + 40 * 1 + 30 * 4)px = 360px. | ||
expect(scrollContainer.props.style.height).toEqual(540); | ||
expect(scrollContainer.props.style.width).toEqual(360); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much better test! Thank you!
Published as 1.1.0 |
🤓