Skip to content

Commit

Permalink
Fixing circular check crash
Browse files Browse the repository at this point in the history
This removes the subscriber array in the ListenerMixin mixin since it's reference will
be reused among the components and break the circular reference check.
There were no tests in place for this and the comment made no sense to
why it was there.

This fixes #80
  • Loading branch information
spoike committed Sep 24, 2014
1 parent fb7d582 commit ff738cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
5 changes: 0 additions & 5 deletions dist/reflux.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,6 @@ var _ = _dereq_('./utils'),
*/
module.exports = _.extend({

/**
* By adding this in the mixin we get error message if other React mixins try to use the same prop
*/
subscriptions: [],

/**
* Cleans up all listener previously registered.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/reflux.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/ListenerMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ var _ = require('./utils'),
*/
module.exports = _.extend({

/**
* By adding this in the mixin we get error message if other React mixins try to use the same prop
*/
subscriptions: [],

/**
* Cleans up all listener previously registered.
*/
Expand Down
17 changes: 17 additions & 0 deletions test/usingListenerMixin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ describe('Managing subscriptions via ListenerMixin', function() {
return assert.eventually.deepEqual(promise, [1337, 'ninja']);
});

describe('using a store and listening to it', function() {
beforeEach(function () {
store = Reflux.createStore({
init: function() {
this.listenTo(action, this.trigger);
}
});

component.listenTo(store, function() {});
});

it('should be possible to listen to the store using two different components', function() {
var component2 = Object.create(Reflux.ListenerMixin);
component2.listenTo(store, function() {});
});
});

describe('get default data', function () {
beforeEach(function() {
component.componentWillUnmount();
Expand Down

0 comments on commit ff738cb

Please sign in to comment.