Skip to content
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

recalculate method? #31

Closed
paulhan221 opened this issue Jun 6, 2020 · 6 comments
Closed

recalculate method? #31

paulhan221 opened this issue Jun 6, 2020 · 6 comments

Comments

@paulhan221
Copy link

Hi, thank you so much for the great project.

I was wondering if there was a recalculate/refresh list method for the dynamic lists? It would be to support updating the height of the row once edited.

davidwincent pushed a commit to davidwincent/react-virtual that referenced this issue Sep 3, 2020
davidwincent pushed a commit to davidwincent/react-virtual that referenced this issue Sep 3, 2020
@davidwincent
Copy link
Contributor

I have the same use case.

Added PR #55 to manually trigger measure when a row is changing height.

@ifndefdeadmau5
Copy link
Contributor

ifndefdeadmau5 commented Feb 3, 2021

It seems internally it re-calculates on every estimateSize update.(also others but I meant among things that we can actually change)
https://github.com/tannerlinsley/react-virtual/blob/7ad46288d5362ce94d600357f8cba087e6adbe63/src/index.js#L50-L61
Below is my temporary workaround until proper fix lands

const [ignored, forceUpdate] = useReducer(x => x + 1, 0);

const rowVirtualizer = useVirtual({
    ...
    estimateSize: React.useCallback(() => 100, [ignored]);
  });

and then call forceUpdate() to manually update measurements

tannerlinsley pushed a commit that referenced this issue Mar 5, 2021
* feat: Add measure method, issue #31

* refactor: measure method

Reduce roundtrips

* Fix: virtualItems should not depend on state

* Fix: remove eslint-disable-next-line react-hooks/exhaustive-deps

Co-authored-by: David Wincent <[email protected]>
Co-authored-by: David Wincent <[email protected]>
@odilbekjon
Copy link

Hello. Do you use index.html?

  1. Do you knwo HTML and CSS?

@tannerlinsley
Copy link
Collaborator

This issue has been automatically closed due to inactivity. If this issue represented an unfulfilled feature request, please start a new discussion instead of an issue. If this issue needs more attention despite its age, please comment to reopen, or open a new issue with updated information. Thanks!

@austincondiff
Copy link

Any progress on a fix here?

@tyv
Copy link

tyv commented Apr 11, 2023

@austincondiff rowVirtualizer.measure();, see PR above #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants