Skip to content

Commit c61ed2a

Browse files
committed
remove unecessary lock for two-way props (fix #1067)
1 parent 31fd208 commit c61ed2a

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/directives/prop.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,14 @@ module.exports = {
1818
var childKey = prop.path
1919
var parentKey = prop.parentPath
2020

21-
// simple lock to avoid circular updates.
22-
// without this it would stabilize too, but this makes
23-
// sure it doesn't cause other watchers to re-evaluate.
24-
var locked = false
25-
function withLock (fn) {
26-
return function (val) {
27-
if (!locked) {
28-
locked = true
29-
fn(val)
30-
_.nextTick(function () {
31-
locked = false
32-
})
33-
}
34-
}
35-
}
36-
3721
this.parentWatcher = new Watcher(
3822
parent,
3923
parentKey,
40-
withLock(function (val) {
24+
function (val) {
4125
if (_.assertProp(prop, val)) {
4226
child[childKey] = val
4327
}
44-
})
28+
}
4529
)
4630

4731
// set the child initial value.
@@ -64,9 +48,9 @@ module.exports = {
6448
self.childWatcher = new Watcher(
6549
child,
6650
childKey,
67-
withLock(function (val) {
51+
function (val) {
6852
parent.$set(parentKey, val)
69-
})
53+
}
7054
)
7155
})
7256
}

0 commit comments

Comments
 (0)