Skip to content

Commit 470e480

Browse files
committed
fix: active value not taking into account scroller active state
1 parent 8ecf007 commit 470e480

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/components/DynamicScrollerItem.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export default {
1919
default: false,
2020
},
2121
22+
/**
23+
* Indicates if the view is actively used to display an item.
24+
*/
2225
active: {
2326
type: Boolean,
2427
required: true,
@@ -53,6 +56,10 @@ export default {
5356
size () {
5457
return (this.vscrollData.validSizes[this.id] && this.vscrollData.sizes[this.id]) || 0
5558
},
59+
60+
finalActive () {
61+
return this.active && this.vscrollData.active
62+
},
5663
},
5764
5865
watch: {
@@ -64,7 +71,7 @@ export default {
6471
}
6572
},
6673
67-
active (value) {
74+
finalActive (value) {
6875
if (!this.size) {
6976
if (value) {
7077
if (!this.vscrollParent.$_undefinedMap[this.id]) {
@@ -122,14 +129,12 @@ export default {
122129
123130
methods: {
124131
updateSize () {
125-
if (this.active && this.vscrollData.active) {
132+
if (this.finalActive) {
126133
if (this.$_pendingSizeUpdate !== this.id) {
127134
this.$_pendingSizeUpdate = this.id
128135
this.$_forceNextVScrollUpdate = null
129136
this.$_pendingVScrollUpdate = null
130-
if (this.active && this.vscrollData.active) {
131-
this.computeSize(this.id)
132-
}
137+
this.computeSize(this.id)
133138
}
134139
} else {
135140
this.$_forceNextVScrollUpdate = this.id
@@ -150,9 +155,11 @@ export default {
150155
},
151156
152157
onVscrollUpdate ({ force }) {
153-
if (!this.active && force) {
158+
// If not active, sechedule a size update when it becomes active
159+
if (!this.finalActive && force) {
154160
this.$_pendingVScrollUpdate = this.id
155161
}
162+
156163
if (this.$_forceNextVScrollUpdate === this.id || force || !this.size) {
157164
this.updateSize()
158165
}

0 commit comments

Comments
 (0)