Skip to content

Performance improvement for initial mount. - #1331

Closed
tokafish wants to merge 3 commits into
bvaughn:masterfrom
tokafish:patch-1
Closed

tokafish wants to merge 3 commits into
bvaughn:masterfrom
tokafish:patch-1

Conversation

@tokafish

@tokafish tokafish commented Feb 15, 2019 •

Copy link
Copy Markdown

First off, thanks for all your work on this library!

I've been trying to optimize the initial mount of a react app, and noticed a few spots where I thought an improvement to react-virtualized might help.

I'll follow up this PR with all of the items in the checklist, but I wanted to get your thoughts on what you thought of this change. Thanks!

tokafish and others added 2 commits February 15, 2019 13:55
* Prevent layout calculation on initial mount if scrollTop/scrollLeft is 0
* Prevent cascading state update for the same case as above.

@wuweiweiwu wuweiweiwu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hi @tokafish, you have committed the whole dist directory. this make it difficult for me to review this MR. please add it back into the gitignore

This reverts commit f1f7f4a.
@tokafish

Copy link
Copy Markdown
Author

@wuweiweiwu updated, sorry about that!

@tokafish

tokafish commented Mar 4, 2019

Copy link
Copy Markdown
Author

@wuweiweiwu Hey - just wanted to check in on this - thanks!

@jincan39

jincan39 commented Mar 5, 2019

Copy link
Copy Markdown

#1290 any thinking on this dude? thanks @wuweiweiwu

@tokafish

tokafish commented May 8, 2019

Copy link
Copy Markdown
Author

@wuweiweiwu Just checking in again - thanks!

@wuweiweiwu

Copy link
Copy Markdown
Contributor

Will take a look soon!

Comment thread source/Grid/Grid.js
if (
(typeof scrollLeft === 'number' && scrollLeft >= 0) ||
(typeof scrollTop === 'number' && scrollTop >= 0)
(typeof scrollLeft === 'number' && scrollLeft > 0) ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why remove 0?

Comment thread source/Grid/Grid.js
if (this._scrollingContainer) {
// setting the ref's scrollLeft and scrollTop.
// Somehow in MultiGrid the main grid doesn't trigger a update on mount.
if (this._scrollingContainer.scrollLeft !== this.state.scrollLeft) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we check if the scrollLeft is 0 again here?

@wuweiweiwu wuweiweiwu closed this Nov 9, 2019
@wuweiweiwu wuweiweiwu reopened this Nov 9, 2019
@github-actions github-actions Bot added the Stale label Sep 24, 2024
@github-actions github-actions Bot closed this Sep 24, 2024
@bvaughn

bvaughn commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Sorry for the very long delay in getting back to you about this!

I've just finished a large update for version 10 of react-virtualized (#1900): the library has been rewritten in TypeScript, every component is now a function component (React 18+ is required), and the source moved from source/ to lib/. Because of that, this PR can't be merged as-is. Version 10's Grid still reads the scroll container's scrollLeft/scrollTop when it mounts.

If you're still interested in this change, I'd welcome a new PR with it rebased onto the version-10 branch (or onto master once version 10 has been merged).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants