Skip to content

Commit 24bb8e4

Browse files
authored
fix(debouncing): (backport from Qv2) cancel pending debounced calls when components are destroyed (quasarframework#11607)
1 parent e5d53dc commit 24bb8e4

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

ui/src/components/infinite-scroll/QInfiniteScroll.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export default Vue.extend({
139139
this.working = false
140140
this.fetching = false
141141
this.__scrollTarget.removeEventListener('scroll', this.poll, passive)
142+
typeof this.poll.cancel === 'function' && this.poll.cancel()
142143
}
143144
},
144145

ui/src/components/parallax/QParallax.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ export default Vue.extend({
103103
__stop () {
104104
if (this.working === true) {
105105
this.working = false
106+
this.__setPos.cancel()
107+
this.__update.cancel()
108+
this.__resizeHandler.cancel()
106109
this.__scrollTarget.removeEventListener('scroll', this.__updatePos, passive)
107110
window.removeEventListener('resize', this.__resizeHandler, passive)
108111
this.__scrollTarget = void 0

ui/src/components/scroll-area/QScrollArea.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,5 +336,9 @@ export default Vue.extend({
336336
this.$emit('scroll', info)
337337
}
338338
}, 0)
339+
},
340+
341+
beforeDestroy () {
342+
this.__emitScroll.cancel()
339343
}
340344
})

ui/src/directives/ScrollFire.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function destroy (el) {
2020
const ctx = el.__qscrollfire
2121
if (ctx !== void 0) {
2222
ctx.scrollTarget.removeEventListener('scroll', ctx.scroll, listenOpts.passive)
23+
ctx.scroll.cancel()
2324
delete el.__qscrollfire
2425
}
2526
}

ui/src/mixins/virtual-scroll.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ export default {
730730
},
731731

732732
beforeDestroy () {
733+
this.__onVirtualScrollEvt.cancel()
733734
const styleSheet = document.getElementById(this.id + '_ss')
734735
styleSheet !== null && styleSheet.remove()
735736
}

0 commit comments

Comments
 (0)