Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Statechart stateObserves() never stops firing with a property path containing @each #607

jcgatica opened this Issue Sep 27, 2011 · 2 comments


None yet
3 participants

When in a state that uses stateObserves, the events get sent properly, but if the observed property path contains @each, the event continues to fire even if the state has been exited. Below is a sample state chart that pays attention to an array controller that manages a collection of objects with an "isEnabled" property. Unfortunately, the objectStateChanged() event fires even if the state chart transitioned from "cleanState" to "dirtyState". Perhaps an issue with the underlying addObserver/removeObserver?

Test.stateChart = SC.Object.create(SC.StatechartManager,

    rootState: SC.State.extend(
        initialSubstate: "cleanState",

        cleanState: SC.State.extend(
            editedObjectsController: null,
            editedObjectsControllerBinding: "Test.modelArrayController",

            enterState: function()
                SC.Logger.log("in clean state");

            objectCheckStateChanged: function() 
                SC.Logger.log("An object was selected");
                return YES;

        dirtyState: SC.State.extend(
            enterState: function()
                SC.Logger.log("Entered dirtyState");

FrozenCanuck commented Sep 28, 2011

Interesting. I'm looking into this.


publickeating commented Apr 30, 2014

I built this exact example and found that this is no longer an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment