re-mount the virtual window #621
Unanswered
is-it-ayush
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I have two views of my data. A virtual item in first view is calculates it's height based on
item.size
but on the second view it does so automatically (I don't set any). I simply switch thestyles
passed onto the item<div />
based on the view state. It works great when I switch from View 1 --> View 2 where the height of every virtual item increases. Although when I switch back from View 2 --> View 1 where height should decreases back again. The height of every virtual item (shown on the screen) does not update at all. This causes the previous items that were already rendered (and are in view) to appear large (incorrect) but new items that are rendered in on scroll to have small (correct) height. I've tried the following,virtualizer.mesaure()
that is dependent on view state within anuseEffect
. This did not work either.This is called for every virtual item.
I'm not sure how to fix this although I currently know this is fixed if I soft-reload the page when everything remounts. That's what lead to believe a remount can fix this. I was hoping for something like
virtualizer.reset()
that would force a remount & reset of virtual table. This is something similar to what react-table has! Although, since it doesn't exist what possible workarounds can I take here. Any help would be awesome. 🙂My last move would be to move everything one level up and have two different virtualizers for both views. Although this is slightly tedious.
Beta Was this translation helpful? Give feedback.
All reactions