-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Episode 9.0 (The One About React Fiber) #577
Conversation
…ard lifecycle measurements
… for CellMeasurerCache.
…pare() with PureComponent
…k updated scrollToIndex offsets
D'oh! Sorry @edulan I missed your comment. Thank you! I plan a final release soon- but until then you can play with it via |
Isn't Fiber only being enabled by default in React 16? |
I did bump the React peer dependency up to 15.3 though because I wanted to use |
Great. I thought you were using some Fiber-specific feature. I still need to invalidate/update cache if a cell changes size or this new CellMeasurer handles it automatically? |
Still need to manually invalidate. Otherwise I'd have to force layout frequently which would defeat the purpose. |
Using this new CellMeasurer still renders the cell twice (for measure and actual rendering) ? |
Yes. You could prevent the second render (if it's worth it) using |
@mquan The way to clear measurements now is to reset your // Clear measurements so CellMeasurer will know to re-measure when it is next rendered
cellMeasurerCache.clearAll()
// Let Grid know to clear its cached position data and re-render
gridRef.recomputeGridSize() |
Maybe it's very simple question, but please understand I'm very new on react. and this is my retunrn [AutoSizer >
|
To test version 9 yourself-
npm i react-virtualized@next
You can also give it a spin on the demo site which is now powered by React fiber too!
Remaining TODO items
(deferred)CellMeasurerCache
should cache and return an average cell size as a sub for an unknown cell'swidth
/height
(instead ofminWidth
/minHeight
). This will make it more accurate over time when estimating layout of previously unmeasured cells.Non-breaking changes
The following backwards-compatible issues will be addressed with version 9:
Bug fixes:
forceUpdateGrids
toMultiGrid
that callsforceUpdate
on all childGrid
s.recomputeCellSizesAndPositions
#568:Collection.forceUpdate()
now callsforceUpdate
on innerCollectionView
Grid
with huge number of rowsNew features:
overscanIndicesGetter
prop forGrid
.Table
styles now support iOS 8.4DEV mode warnings:
CellMeasurer
with an improperly configuredGrid
will now log a warning.Grid
cells rendered without astyle
prop now log a warning.Backwards-breaking changes
react-addons-shallow-compare
and replace it withReact.PureComponent
as the docs suggest.CellManager
has been completely rewritten to support fiber. It's more flexible than before but uses a very different syntax. See below for more detailed instructions on how to upgrade.CellMeasurer
changesPreviously,
CellMeasurer
wrapped aGrid
and measured all rows and/or columns, like so:This had one major drawback:
CellMeasurer
could not be used to measure only specific rows/columns. A secondary, related drawback was that cell measurements were cached by index. Because of this insertions, deletions, and re-ordering invalidated measurements and require re-measuring.The new
CellMeasurer
wraps individual cells, allowing selective measurement. By providing akeyMapper
, measurements can also be cached by cell ID instead of index- making them reusable after insertions, deletions, and re-orders. The new syntax for usingCellMeasurer
is like so: