Skip to content

Commit 5edfb9e

Browse files
committed
use _.cancellable in component
1 parent 1b03895 commit 5edfb9e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/directives/component.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,12 @@ module.exports = {
110110

111111
resolveCtor: function (id, cb) {
112112
var self = this
113-
var pendingCb = this._pendingCb = function (ctor) {
114-
if (!pendingCb.invalidated) {
115-
self.ctorId = id
116-
self.Ctor = ctor
117-
cb()
118-
}
119-
}
120-
this.vm._resolveComponent(id, pendingCb)
113+
this._pendingCb = _.cancellable(function (ctor) {
114+
self.ctorId = id
115+
self.Ctor = ctor
116+
cb()
117+
})
118+
this.vm._resolveComponent(id, this._pendingCb)
121119
},
122120

123121
/**
@@ -128,7 +126,7 @@ module.exports = {
128126

129127
invalidatePending: function () {
130128
if (this._pendingCb) {
131-
this._pendingCb.invalidated = true
129+
this._pendingCb.cancel()
132130
this._pendingCb = null
133131
}
134132
},

0 commit comments

Comments
 (0)