Skip to content

Commit 7df4b45

Browse files
committed
docs: created 2.10 migration guide
1 parent 2241e61 commit 7df4b45

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

guide/source/2.10-migration.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Migrating to Meteor 2.10
3+
description: How to migrate your application to Meteor 2.10.
4+
---
5+
6+
Most of the new features in Meteor 2.10 are either applied directly behind the scenes (in a backwards compatible manner) or are opt-in. For a complete breakdown of the changes, please refer to the [changelog](http://docs.meteor.com/changelog.html).
7+
8+
The above being said, there are a few items that you should implement to have easier time in the future.
9+
10+
<h3 id="async-tracker">Async Tracker</h3>
11+
12+
Wrapping your async calls in a ```Tracker.withComputation``` method will make sure that even async calls are reactive.
13+
14+
before if you used a code like the one below it would only run once and would not be reactive
15+
```javascript
16+
Tracker.autorun(async function example1() {
17+
let asyncData = await asyncDataFunction();
18+
let users = Meteor.users.find({}).fetch();
19+
});
20+
```
21+
To be reactive before 2.10 you would need to call the reactive data sources before the async call
22+
23+
```javascript
24+
Tracker.autorun(async function example2() {
25+
let users = Meteor.users.find({}).fetch();
26+
let asyncData = await asyncDataFunction();
27+
});
28+
```
29+
Now you can have both examples reactive by wrapping the async call in a ```Tracker.withComputation``` method
30+
31+
```javascript
32+
33+
Tracker.autorun(async function example1(computation) {
34+
let asyncData = await Tracker.withComputation(computation, () => asyncDataFunction());
35+
let users = Meteor.users.find({}).fetch();
36+
});
37+
38+
Tracker.autorun(async function example2(computation) {
39+
let users = await Tracker.withComputation(computation, () => Meteor.users.find({}).fetch());
40+
let asyncData = await Tracker.withComputation(computation, () => asyncDataFunction());
41+
42+
});
43+
44+
// using async mongo api
45+
Tracker.autorun(async function example2(computation) {
46+
let asyncData = await Tracker.withComputation(computation, () => asyncDataFunction());
47+
let users = await Tracker.withComputation(computation, () => Meteor.users.find({}).fetchAsync());
48+
});
49+
```
50+
<h2 id="older-versions">Migrating from a version older than 2.9?</h2>
51+
52+
If you're migrating from a version of Meteor older than Meteor 2.9, there may be important considerations not listed in this guide. Please review the older migration guides for details:
53+
54+
* [Migrating to Meteor 2.9](2.9-migration.html) (from 2.8)
55+
* [Migrating to Meteor 2.8](2.8-migration.html) (from 2.7)
56+
* [Migrating to Meteor 2.7](2.7-migration.html) (from 2.6)
57+
* [Migrating to Meteor 2.6](2.6-migration.html) (from 2.5)
58+
* [Migrating to Meteor 2.5](2.5-migration.html) (from 2.4)
59+
* [Migrating to Meteor 2.4](2.4-migration.html) (from 2.3)
60+
* [Migrating to Meteor 2.3](2.3-migration.html) (from 2.2)
61+
* [Migrating to Meteor 2.2](2.2-migration.html) (from 2.0)
62+
* [Migrating to Meteor 2.0](2.0-migration.html) (from 1.12)
63+
* [Migrating to Meteor 1.12](1.12-migration.html) (from 1.11)
64+
* [Migrating to Meteor 1.11](1.11-migration.html) (from 1.10.2)
65+
* [Migrating to Meteor 1.10.2](1.10.2-migration.html) (from 1.10)
66+
* [Migrating to Meteor 1.10](1.10-migration.html) (from 1.9.3)
67+
* [Migrating to Meteor 1.9.3](1.9.3-migration.html) (from 1.9)
68+
* [Migrating to Meteor 1.9](1.9-migration.html) (from 1.8.3)
69+
* [Migrating to Meteor 1.8.3](1.8.3-migration.html) (from 1.8.2)
70+
* [Migrating to Meteor 1.8.2](1.8.2-migration.html) (from 1.8)
71+
* [Migrating to Meteor 1.8](1.8-migration.html) (from 1.7)
72+
* [Migrating to Meteor 1.7](1.7-migration.html) (from 1.6)
73+
* [Migrating to Meteor 1.6](1.6-migration.html) (from 1.5)
74+
* [Migrating to Meteor 1.5](1.5-migration.html) (from 1.4)
75+
* [Migrating to Meteor 1.4](1.4-migration.html) (from 1.3)
76+
* [Migrating to Meteor 1.3](1.3-migration.html) (from 1.2)

0 commit comments

Comments
 (0)