Circular checks are broken #80

Closed
spoike opened this Issue Sep 24, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@spoike
Member

spoike commented Sep 24, 2014

Listening to stores in components are broken in 0.1.8.

More info will come as I am debugging this now.

@spoike spoike added the bug label Sep 24, 2014

@spoike spoike added this to the 0.1.9 milestone Sep 24, 2014

@spoike

This comment has been minimized.

Show comment
Hide comment
@spoike

spoike Sep 24, 2014

Member

Apparently listening to e.g. the same store in two different components will fail the circular check even though there is no circular loop happening.

Test example

    var tickAction = Reflux.createAction(),
        currentTick = 0;

    var store = Reflux.createStore({
        init: function() {
            this.listenTo(tickAction, this.tick);
        },
        tick: function(tick) {
            this.trigger("tick", tick);
        }
    });

    Console1 = function() {
        this.listenTo(store, this.output);
    }
    Console1.prototype.output = function(tick) {
        console.log('console1;', tick)
    };
    _.extend(Console1.prototype, Reflux.ListenerMixin);

    Console2 = function() {
        this.listenTo(store, this.output); // ERROR'D!
    }
    Console2.prototype.output = function() {
        console.log(arguments);
    };
    _.extend(Console2.prototype, Reflux.ListenerMixin);

    var c1 = new Console1();
    var c2 = new Console2();

    tickAction(currentTick++);
Member

spoike commented Sep 24, 2014

Apparently listening to e.g. the same store in two different components will fail the circular check even though there is no circular loop happening.

Test example

    var tickAction = Reflux.createAction(),
        currentTick = 0;

    var store = Reflux.createStore({
        init: function() {
            this.listenTo(tickAction, this.tick);
        },
        tick: function(tick) {
            this.trigger("tick", tick);
        }
    });

    Console1 = function() {
        this.listenTo(store, this.output);
    }
    Console1.prototype.output = function(tick) {
        console.log('console1;', tick)
    };
    _.extend(Console1.prototype, Reflux.ListenerMixin);

    Console2 = function() {
        this.listenTo(store, this.output); // ERROR'D!
    }
    Console2.prototype.output = function() {
        console.log(arguments);
    };
    _.extend(Console2.prototype, Reflux.ListenerMixin);

    var c1 = new Console1();
    var c2 = new Console2();

    tickAction(currentTick++);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment