Skip to content

Commit 1b69536

Browse files
souljorjetangbc
authored andcommitted
fix: extraProps mutation in item render
Prevent adding `source` and `index` to parent's `extraProps` on each item render.
1 parent 37bf0c2 commit 1b69536

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/item.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,20 @@ export const Item = Vue.component('virtual-list-item', {
5151
props: ItemProps,
5252

5353
render (h) {
54-
const { tag, component, extraProps = {}, index, scopedSlots = {}, uniqueKey } = this
55-
extraProps.source = this.source
56-
extraProps.index = index
54+
const { tag, component, extraProps = {}, index, source, scopedSlots = {}, uniqueKey } = this;
55+
const props = {
56+
...extraProps,
57+
source,
58+
index,
59+
};
5760

5861
return h(tag, {
5962
key: uniqueKey,
6063
attrs: {
6164
role: 'listitem'
6265
}
6366
}, [h(component, {
64-
props: extraProps,
67+
props,
6568
scopedSlots: scopedSlots
6669
})])
6770
}

0 commit comments

Comments
 (0)