guide/source/2.10-migration.md
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.
The above being said, there are a few items that you should implement to have easier time in the future.
<h3 id="async-tracker">Async Tracker</h3>Wrapping your async calls in a Tracker.withComputation method will make sure that even async calls are reactive.
before if you used a code like the one below it would only run once and would not be reactive
Tracker.autorun(async function example1() {
let asyncData = await asyncDataFunction();
let users = Meteor.users.find({}).fetch();
});
To be reactive before 2.10 you would need to call the reactive data sources before the async call
Tracker.autorun(async function example2() {
let users = Meteor.users.find({}).fetch();
let asyncData = await asyncDataFunction();
});
Now you can have both examples reactive by wrapping the async call in a Tracker.withComputation method
Tracker.autorun(async function example1(computation) {
let asyncData = await Tracker.withComputation(computation, () => asyncDataFunction());
let users = Meteor.users.find({}).fetch();
});
Tracker.autorun(async function example2(computation) {
let users = await Tracker.withComputation(computation, () => Meteor.users.find({}).fetch());
let asyncData = await Tracker.withComputation(computation, () => asyncDataFunction());
});
// using async mongo api
Tracker.autorun(async function example2(computation) {
let asyncData = await Tracker.withComputation(computation, () => asyncDataFunction());
let users = await Tracker.withComputation(computation, () => Meteor.users.find({}).fetchAsync());
});
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: