MobX

A MobX plugin for Asayer. This plugin allows you to see the MobX events during session replay.

Installation

npm i @asayerio/tracker-mobx --save

Usage

Initialize the @asayerio/tracker package as usual and load the plugin into it. Then put the generated middleware into your Redux chain.

import Tracker from '@asayerio/tracker';
import trackerMobX from '@asayerio/tracker-mobx';
const tracker = new Tracker({
projectID: PROJECT_ID,
});
tracker.use(trackerMobX());

This plugin is inspired by mobx-logger, hence it has similar configurations.

The default configurations are following

trackerMobX({
action: true,
reaction: true,
transaction: true,
compute: true
})

You can disable logging for actions and computed properties by providing a static trackerMobXConfig. This is useful to protect the private user data and keep your logs clean.

Here's an example of how to disable logging for all actions and computed properties for a given class.

class MyModel {
static trackerMobXConfig: {
enabled: false
};
// ...
}

Alternatively you can disable logging for particular class methods.

class MyStore {
static trackerMobXConfig: {
methods: {
myAction: false
}
};
@action myAction() {
// calls to this method won't be logged
}
}

You can combine the above examples to whitelist certain actions for being logged.

class MyStore {
static trackerMobXConfig: {
enabled: false,
methods: {
myAction: true
}
};
@action myAction() {
// only calls to this method are being logged
}
// other methods won't be logged ...
}

Please keep in mind that at this point trackerMobXConfig is only available for actions (@action) and computed properties (@computed).