From 2ec758a1badfcb05ac412f608c8db0f988ddded3 Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Sat, 21 May 2016 14:43:40 +0200 Subject: [PATCH 1/2] Update index.jsx Save the subscriptions based on only the name of the subscription. So you don't save multiple subscriptions of the same name. --- lib/index.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/index.jsx b/lib/index.jsx index 9edb94f..7873f20 100644 --- a/lib/index.jsx +++ b/lib/index.jsx @@ -11,7 +11,11 @@ Tracker.Component = class extends React.Component { } subscribe(name, ...options) { - return this.__subs[JSON.stringify(arguments)] = + if (this.__subs[arguments[0]]) { + this.__subs[arguments[0]].stop() + delete this.__subs[arguments[0]] + } + return this.__subs[arguments[0]] = this.__subscribe.apply(this, [name, ...options]); } From 65aef4bdb8ffc6281c265da31a6a074bdc9e25c9 Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Tue, 7 Jun 2016 14:40:14 +0200 Subject: [PATCH 2/2] Update index.jsx --- lib/index.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/index.jsx b/lib/index.jsx index 7873f20..82b4e61 100644 --- a/lib/index.jsx +++ b/lib/index.jsx @@ -11,11 +11,11 @@ Tracker.Component = class extends React.Component { } subscribe(name, ...options) { - if (this.__subs[arguments[0]]) { - this.__subs[arguments[0]].stop() - delete this.__subs[arguments[0]] + if (this.__subs[name) { + this.__subs[name].stop() + delete this.__subs[name] } - return this.__subs[arguments[0]] = + return this.__subs[name] = this.__subscribe.apply(this, [name, ...options]); }