Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

feat(Tree): add virtualized tree prototype#1890

Merged
jurokapsiar merged 22 commits intomasterfrom
feat/add-virtualized-tree-prototype
Sep 13, 2019
Merged

feat(Tree): add virtualized tree prototype#1890
jurokapsiar merged 22 commits intomasterfrom
feat/add-virtualized-tree-prototype

Conversation

@silviuaavram
Copy link
Collaborator

@silviuaavram silviuaavram commented Sep 4, 2019

Attempt to provide virtualization capability to a Tree via a render prop.

react-virtualized adds a style param to the component it renders, and it needs to be there at render.

Tried React.cloneElement to continue to pass rendered items to the Virtualized render prop but it's not working as expected.

Added another way of doing it by Tree passing render callbacks to the Virtualized render prop, that will render it along with the style prop, and that works.

Work in progress.

@codecov
Copy link

codecov bot commented Sep 5, 2019

Codecov Report

Merging #1890 into master will decrease coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1890      +/-   ##
==========================================
- Coverage    70.5%   70.47%   -0.04%     
==========================================
  Files         884      884              
  Lines        7794     7796       +2     
  Branches     2278     2280       +2     
==========================================
- Hits         5495     5494       -1     
- Misses       2289     2291       +2     
- Partials       10       11       +1
Impacted Files Coverage Δ
packages/react/src/components/Tree/TreeItem.tsx 72.09% <100%> (+0.66%) ⬆️
packages/react/src/components/Tree/Tree.tsx 71.56% <57.14%> (-2.69%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a9989e...aeabfd8. Read the comment docs.


function generateLevel(level, parent = '') {
const result = []
for (let index = 0; index < getItemsNumber(minItems, maxItems); index++) {
Copy link
Member

Choose a reason for hiding this comment

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

_.times from Lodash?

Co-Authored-By: Oleksandr Fediashov <olfedias@microsoft.com>
@vercel vercel bot temporarily deployed to staging September 11, 2019 12:48 Inactive
@vercel vercel bot temporarily deployed to staging September 12, 2019 09:29 Inactive
const cache = new CellMeasurerCache({
defaultHeight: 20,
fixedWidth: true,
})
Copy link
Member

Choose a reason for hiding this comment

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

Should it be persistent between renders?

const [cache] = React.useState(() => 
  new CellMeasurerCache({
    defaultHeight: 20,
    fixedWidth: true,
  })
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@layershifter
Copy link
Member

tree-v

I am not that it's a PR blocker, but there are render delays on few opened items.

@silviuaavram
Copy link
Collaborator Author

@layershifter if you go to http://bvaughn.github.io/react-virtualized/#/components/List and make the row size ~20 px those take a while to render as well. probably it will perform better if we had fewer, taller items in our example.

@jurokapsiar jurokapsiar merged commit 6935b97 into master Sep 13, 2019
@jurokapsiar jurokapsiar deleted the feat/add-virtualized-tree-prototype branch September 13, 2019 09:29
layershifter pushed a commit that referenced this pull request Sep 13, 2019
* add react-virtualized to package and yarn lock

* add virtualized render prop to Tree

* add virtualized tree in prototypes

* add alternative solution in comments

* add back as any from merging master

* have refs for all items

* fix the cloneElement approach

* fix ref issue

* increase virtualized tree size

* rename the render prop

* add changelog

* fix use of prop name

* move items code from prototype

* address code review

* make prototype public

Co-Authored-By: Oleksandr Fediashov <olfedias@microsoft.com>

* use lodash times function

(cherry picked from commit 6935b97)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants