Skip to content

Commit

Permalink
Bring in new Meteor Tracker to replace 5 years outdated trackr package (
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealNate authored Jan 20, 2021
1 parent 3f077b8 commit 6f418ce
Show file tree
Hide file tree
Showing 8 changed files with 649 additions and 14 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Version | Supported |
| ------- | ------------------ |
| 2.0.x | :white_check_mark: |
| >=2.0.0 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meteorrn/core",
"version": "2.1.1",
"version": "2.1.2",
"description": "Full Meteor Client for React Native",
"main": "src/index.js",
"repository": {
Expand Down Expand Up @@ -29,7 +29,6 @@
"minimongo-cache": "0.0.48",
"node-require-fallback": "^1.0.0",
"prop-types": "^15.5.10",
"trackr": "^2.0.2",
"underscore": "^1.8.3",
"wolfy87-eventemitter": "^4.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Collection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Tracker from 'trackr';
import Tracker from './Tracker.js';
import EJSON from 'ejson';
import _ from 'underscore';

Expand Down
4 changes: 2 additions & 2 deletions src/Data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import minimongo from 'minimongo-cache';
import Trackr from 'trackr';
import Tracker from './Tracker.js';

const db = new minimongo();
db.debug = false;
Expand Down Expand Up @@ -35,7 +35,7 @@ else {

function runAfterOtherComputations(fn) {
afterInteractions(() => {
Trackr.afterFlush(() => {
Tracker.afterFlush(() => {
fn();
});
});
Expand Down
12 changes: 6 additions & 6 deletions src/Meteor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Trackr from 'trackr';
import Tracker from './Tracker.js';
import EJSON from 'ejson';
import DDP from '../lib/ddp.js';
import Random from '../lib/Random';
Expand All @@ -22,7 +22,7 @@ const Meteor = {
},
Random,
Mongo,
Tracker: Trackr,
Tracker,
EJSON,
ReactiveDict,
Collection,
Expand Down Expand Up @@ -290,7 +290,7 @@ const Meteor = {
params: EJSON.clone(params),
inactive: false,
ready: false,
readyDeps: new Trackr.Dependency(),
readyDeps: new Tracker.Dependency(),
readyCallback: callbacks.onReady,
stopCallback: callbacks.onStop,
stop: function() {
Expand Down Expand Up @@ -320,19 +320,19 @@ const Meteor = {
subscriptionId: id,
};

if (Trackr.active) {
if (Tracker.active) {
// We're in a reactive computation, so we'd like to unsubscribe when the
// computation is invalidated... but not if the rerun just re-subscribes
// to the same subscription! When a rerun happens, we use onInvalidate
// as a change to mark the subscription "inactive" so that it can
// be reused from the rerun. If it isn't reused, it's killed from
// an afterFlush.
Trackr.onInvalidate(function(c) {
Tracker.onInvalidate(function(c) {
if (Data.subscriptions[id]) {
Data.subscriptions[id].inactive = true;
}

Trackr.afterFlush(function() {
Tracker.afterFlush(function() {
if (Data.subscriptions[id] && Data.subscriptions[id].inactive) {
handle.stop();
}
Expand Down
Loading

0 comments on commit 6f418ce

Please sign in to comment.