How do I use the tracker-mobx-autorun package?

I’ve been using mobx/react for a while now, i got a new project so i’ve decided to use meteor instead of express. But I can’t seem to find a way to connect my subscriptions to a mobx store and have it automatically reactive.

i found this package tracker-mobx-autorun but i have no idea how i would use this with react. If you’ve used it before, an example will suffice. i’m a very fast learner.

thanks a lot.

1 Like

did you worked it out @seunlanlege?
Any hint?


//  @flow
import { Meteor } from 'meteor/meteor'
import Dash from '../store/DashboardStore'
import User from '../store/User'
import { Donor } from '../Classes/Donor'
import { Beneficiary } from '../Classes/Beneficiary'
import { DonationPackages } from '../Classes/Packages'

import autorun from 'meteor/space:tracker-mobx-autorun'

const DashAutorun = () => {
  if (User.userId) {
    const handleDonations = Meteor.subscribe('user.donations')
    const handleWithdrawals = Meteor.subscribe('user.withdrawals')
    const handlePackages = Meteor.subscribe('packages')

    if (User.isKanye) {
      const images = Meteor.subscribe('images.all')
      Dash.toggleLoading('isImagesLoading', !images.ready())

    if (handlePackages.ready()) {
      Dash.toggleLoading('isDonationPackageLoading', !handlePackages.ready())

    if (handleDonations.ready()) {
      Dash.toggleLoading('isDonationLoading', !handleDonations.ready())
        ? Dash.setDonations(Donor.find().fetch())
        : Dash.setDonations(Donor.find({ donor: User.userId }).fetch())

    if (handleWithdrawals.ready()) {
      Dash.toggleLoading('isWithdrawalLoading', !handleWithdrawals.ready())
        ? Dash.setWithdrawals(Beneficiary.find().fetch())
        : Dash.setWithdrawals(Beneficiary.find({ beneficiary: User.userId }).fetch())


export default autorun(DashAutorun)


import { FlowRouter } from 'meteor/kadira:flow-router'
import { Meteor } from 'meteor/meteor'

import '../imports/startup/client'
import dashAutoruns from '../imports/autoruns/dashAutoruns'


Meteor.startup(() => {

Thank you for your code snippet.

Question… Do I need to .start() all my autoruns at once? Or can I do it
on a container on another route page?

If its the case, does it affect performance too many autoruns started at

you can start it anywhere, conditionally and in your route triggers.

Sorry for the late reply, but, I am having an issue, It might happened to you.

If I start the autorun on a container which is rendered on home page, when I navigate to /about and then switch back to /home, the autorun is called again, and therefore getting unwanted side effects, such as, if I have a button to insert a Todo, when pressing it, the list will show 2 additional Todos.

How do I stop the autorun on the container?