Skip to content

Commit c31b92b

Browse files
author
Guillaume Chau
committed
fix: $startMeteor and $stopMeteor, closes #29
1 parent 7b3f0b7 commit c31b92b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,21 @@ export default {
6363
this._subsAutorun = {}
6464
this._subs = {}
6565

66-
Object.defineProperty(this, '$subReady', {
67-
get: () => this.$data.$meteor.subs,
68-
enumerable: true,
69-
configurable: true,
70-
})
66+
// First launch
67+
if (this._meteorLaunch == null) {
68+
this._meteorLaunch = 0
69+
70+
Object.defineProperty(this, '$subReady', {
71+
get: () => this.$data.$meteor.subs,
72+
enumerable: true,
73+
configurable: true,
74+
})
75+
}
7176
}
7277

7378
function launch () {
7479
this._meteorActive = true
80+
this._meteorLaunch++
7581

7682
let meteor = this.$options.meteor
7783

@@ -210,6 +216,7 @@ export default {
210216

211217
$startMeteor () {
212218
if (!this._meteorActive) {
219+
prepare.call(this)
213220
launch.call(this)
214221
}
215222
},
@@ -220,7 +227,7 @@ export default {
220227
try {
221228
tracker.stop()
222229
} catch (e) {
223-
console.error(e, tracker)
230+
if (Meteor.isDevelopment) console.error(e, tracker)
224231
}
225232
})
226233
this._trackerHandles = null
@@ -234,7 +241,7 @@ export default {
234241
throw Error(`Meteor data '${key}': You must provide a function which returns the result.`)
235242
}
236243

237-
if (hasProperty(this.$data, key) || hasProperty(this.$props, key) || hasProperty(this, key)) {
244+
if (hasProperty(this.$data, key) || hasProperty(this.$props, key) || (hasProperty(this, key) && this._meteorLaunch === 1)) {
238245
throw Error(`Meteor data '${key}': Property already used in the component data, props or other.`)
239246
}
240247

0 commit comments

Comments
 (0)