
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-window-dynamic-list
Advanced tools
A naive approach for virtualizing a list with dynamically sized items
Made with the awesome create-react-library
react-window?This library comes to partly solve the case of rendering dynamically sized items with react-window, for more information about the issue please read this thread. Before you overjoy please read the limitations of this approach down bellow :sleepy:
👉 check out dynamic list in action
:pencil2: Play with the demo in sandbox
npm install --save react-window-dynamic-list

Yep. its that simple :satisfied:
The API is the same as VariableSizeList with some small changes and additions.
itemCount you must pass data (read more)itemSize and estimatedItemSize for you :sunglasses:| Property | Type | Required? | Default | Description |
|---|---|---|---|---|
| data | Object[] | ✓ | All of the data that will be displayed in the list. Each object must contain an unique id field.For example: [{id: 1, ...}, {id: 2, ....}] | |
| cache | Object | ✓ | The cache object which the list will use for caching the calculated sizes. Check the example for how to create it. | |
| lazyMeasurement | boolean | true | Whether the application should fill the cache in the background. Please note: After each cache clear the application will restart the lazy cache filling (For example after adding or removing an item) For more information read the caching section. | |
| recalculateItemsOnResize | Object | { width: false, height: false } | Whether the list should recalculate the items size if its own size has changed. This value should not change from its initial one. Currently the feature is supported but far from perfect, therefore it is disabled by default. | |
| measurementContainerElement | Function | ({style, children}) => ReactNode | A custom container element in which the elements will be rendered for measuring. Especially useful for changing the scrollbar width. You must pass the style prop to your element. | |
| debug | boolean | false | Whether the measurement layer should be visible, useful for debugging a custom measurementContainerElement |
Just in time measurement with caching in the background.
The algorithm is divided into two main concepts:
We measure each item in the list by temporary rendering it with react-dom in a different application.
For more information please read this great article.
In order for just in time measurements to be effective we need to cache the measurements. Currently there are two caching modes:
resetAfterIndex function of VariableSizeList.Your data doesn't change its size.
ajax or images).Currently only supports vertical layout. (didn't have time to implement support for horizontal).
All of the styling regarding the items must be inline or not affected by location in the DOM.
Changes to the list's scrollbar, especially the width, should also effect the measurement container div. Since we pre render the items in order to measure them the size of the scrollbar is important in the pre rendered item as well. This can be achieved in the following ways:
measurementContainerElement prop.MIT © gnir-work
FAQs
A naive approach for virtualizing a list with dynamically sized items
The npm package react-window-dynamic-list receives a total of 795 weekly downloads. As such, react-window-dynamic-list popularity was classified as not popular.
We found that react-window-dynamic-list demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.