Skip to content

Commit

Permalink
DOCS: Fix typo in Tracker.md
Browse files Browse the repository at this point in the history
Before it was using `findAsync({}).fetch` but it should have been `find({}).fetchAsync()`
  • Loading branch information
Grubba27 committed Feb 3, 2025
1 parent f6b6ae8 commit 8ea36ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions v3-docs/docs/api/Tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ Tracker.autorun(async function example1(computation) {
// Code before the first await will stay reactive.
reactiveVar1.get(); // This will trigger a rerun.

let links = await LinksCollection.findAsync({}).fetch(); // First async call will stay reactive.
let links = await LinksCollection.find({}).fetchAsync(); // First async call will stay reactive.

// Code after the first await looses Tracker.currentComputation: no reactivity.
reactiveVar2.get(); // This won't trigger a rerun.

// You can bring back reactivity with the Tracker.withCompuation wrapper:
let users = await Tracker.withComputation(computation, () => Meteor.users.findAsync({}).fetch());
let users = await Tracker.withComputation(computation, () => Meteor.users.find({}).fetchAsync());

// Code below will again not be reactive, so you will need another Tracker.withComputation.
const value = Tracker.withComputation(computation, () => reactiveVar3.get()); // This will trigger a rerun.
Expand Down

0 comments on commit 8ea36ea

Please sign in to comment.