Problem with defines called out of order #1519

Closed
moschel opened this Issue Mar 13, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@moschel
Contributor

moschel commented Mar 13, 2015

Defines that are dependent on each other seem to not fire in the correct order. I have a breaking test showing this here: a3d9d38

@moschel

This comment has been minimized.

Show comment
Hide comment
@moschel

moschel Mar 13, 2015

Contributor

Here's the breaking test:

        var MyMap = can.Map.extend({
          define: {
            fulfillmentType: {
              get: function() {
                return this.attr('ft');
              },

              set: function(newVal) {
                this.attr('ft', newVal);
                return newVal;
              }
            },

            propA: {
              get: function() {
                return this.attr('fulfillmentType') == 'a';
              }
            },

            propB: {
              get: function() {
                return this.attr('fulfillmentType') == 'b';
              }
            },

            combined: {
              get: function() {
                return this.attr('propA') || this.attr('propB');
              }
            }
          }
        });

        var map = new MyMap({ft: 'a'});

        map.on('combined', function(){});
        map.on('propA', function(){});
        map.on('propB', function(){});

        map.attr('fulfillmentType', 'b');
        equal(map.attr('combined'), true);

This seems very dependent on the order. If I change the order the properties are bound, it doesn't break. If I remove propA or propB altogether, it doesn't break.

Contributor

moschel commented Mar 13, 2015

Here's the breaking test:

        var MyMap = can.Map.extend({
          define: {
            fulfillmentType: {
              get: function() {
                return this.attr('ft');
              },

              set: function(newVal) {
                this.attr('ft', newVal);
                return newVal;
              }
            },

            propA: {
              get: function() {
                return this.attr('fulfillmentType') == 'a';
              }
            },

            propB: {
              get: function() {
                return this.attr('fulfillmentType') == 'b';
              }
            },

            combined: {
              get: function() {
                return this.attr('propA') || this.attr('propB');
              }
            }
          }
        });

        var map = new MyMap({ft: 'a'});

        map.on('combined', function(){});
        map.on('propA', function(){});
        map.on('propB', function(){});

        map.attr('fulfillmentType', 'b');
        equal(map.attr('combined'), true);

This seems very dependent on the order. If I change the order the properties are bound, it doesn't break. If I remove propA or propB altogether, it doesn't break.

justinbmeyer added a commit that referenced this issue Mar 13, 2015

makes events triggered for the current batch within the current batch…
… happen after all schedule event handlers are fired #1519

@justinbmeyer justinbmeyer added the bug label Mar 13, 2015

@daffl daffl added this to the 2.2.1 milestone Mar 13, 2015

justinbmeyer added a commit that referenced this issue Mar 17, 2015

makes events triggered for the current batch within the current batch…
… happen after all schedule event handlers are fired #1519
@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Mar 17, 2015

Contributor

This is closed via #1520

Contributor

daffl commented Mar 17, 2015

This is closed via #1520

@daffl daffl closed this Mar 17, 2015

m-mujica added a commit that referenced this issue Apr 9, 2015

@m-mujica

This comment has been minimized.

Show comment
Hide comment
@m-mujica

m-mujica Apr 9, 2015

Contributor

It seems that this issue was not totally fixed. In this branch I've created a new failing test with more complex computes.

nested-computes

Contributor

m-mujica commented Apr 9, 2015

It seems that this issue was not totally fixed. In this branch I've created a new failing test with more complex computes.

nested-computes

@m-mujica m-mujica reopened this Apr 9, 2015

@daffl daffl modified the milestones: 2.2.5, 2.2.1 Apr 10, 2015

@daffl daffl modified the milestones: 2.2.6, 2.2.5 Apr 21, 2015

@daffl daffl closed this May 15, 2015

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