-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
fix(VDataTableVirtual): dont render all rows when items are updated #18837
Conversation
7cd11a6
to
d0765f1
Compare
@@ -33,7 +33,7 @@ export function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>) { | |||
|
|||
const itemHeight = shallowRef(0) | |||
watchEffect(() => { | |||
itemHeight.value = parseFloat(props.itemHeight || 0) | |||
itemHeight.value = parseFloat(props.itemHeight || 16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a better solution but magic numbers are bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The default value is set here to avoid poisoning getSize() |
Setting it here too could cause problems with items that are actually <16px
f931c2e
to
748056c
Compare
cd170f8
to
98e57dc
Compare
This Pull Request is being closed due to inactivity. If you have any additional questions, please reach out to us in our Discord community. |
resolves #18806
Set default virtual item's
itemHeight
from 0 to 16.Description
packages/vuetify/src/composables/virtual.tsvirtual.ts
When
items
is updated from an empty list to a non-empty list (e.g. items.length = 1000).sizes
andoffsets
will be initialized with zeros array.calculateIndex (0)
will got 499 not 0. Then,_calculateVisibleItems
will setfirst
to 0, andlast
to999
.Then,
computedItems
will return all items, which are actually rendered rows.Markup: