Skip to content

Commit 58740c1

Browse files
committed
prop watchers should be sync
1 parent ae2432e commit 58740c1

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/directives/prop.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var _ = require('../util')
21
var Watcher = require('../watcher')
32

43
module.exports = {
@@ -16,25 +15,20 @@ module.exports = {
1615
// without this it would stabilize too, but this makes
1716
// sure it doesn't cause other watchers to re-evaluate.
1817
var locked = false
19-
var lock = function () {
20-
locked = true
21-
_.nextTick(unlock)
22-
}
23-
var unlock = function () {
24-
locked = false
25-
}
2618

2719
if (!prop.oneWayUp) {
2820
this.parentWatcher = new Watcher(
2921
parent,
3022
parentKey,
3123
function (val) {
3224
if (!locked) {
33-
lock()
25+
locked = true
3426
// all props have been initialized already
3527
child[childKey] = val
28+
locked = false
3629
}
37-
}
30+
},
31+
{ sync: true }
3832
)
3933

4034
// set the child initial value first, before setting
@@ -51,10 +45,12 @@ module.exports = {
5145
childKey,
5246
function (val) {
5347
if (!locked) {
54-
lock()
48+
locked = true
5549
parent.$set(parentKey, val)
50+
locked = false
5651
}
57-
}
52+
},
53+
{ sync: true }
5854
)
5955

6056
// set initial value for one-way up binding

0 commit comments

Comments
 (0)