Infinite batching #2272

Closed
dylanrtt opened this Issue Feb 17, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@dylanrtt
Contributor

dylanrtt commented Feb 17, 2016

Introduced in 2.3.11. Still present in 2.3.16/latest.

{{#if show}}
  <select multiple {($value)}="foo"></select>
  <select multiple {($value)}="bar"></select>
{{/show}}

If show is changes to truthy in a batch, some kind of infinite batch occurs when the selects are inserted.

2.3.11 mostly had changes to batching, so I'm not sure how the multiple selects play into it. The test requires both to be present and both to be 'multiple', so it needs some narrowing down.

It does not happen if I use can-value instead of {($value)}. Aren't they supposed to be the same for select elements? (I understand they are not the same for some form elements.)

http://jsbin.com/basowirasa/1/edit?html,js,output

@daffl daffl modified the milestones: 2.3.17, 2.3.18 Feb 18, 2016

@daffl daffl modified the milestones: 2.3.19, 2.3.18 Mar 3, 2016

@justinbmeyer justinbmeyer self-assigned this Mar 4, 2016

@daffl daffl modified the milestones: 2.3.20, 2.3.19 Mar 4, 2016

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Mar 5, 2016

Contributor

In 3.0, we should make setting a compute not return the new value of the compute. This will greatly simplify computes behavior and make situations like this less common.

Contributor

justinbmeyer commented Mar 5, 2016

In 3.0, we should make setting a compute not return the new value of the compute. This will greatly simplify computes behavior and make situations like this less common.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Mar 5, 2016

Contributor

Ok, I discovered the cause. With the new batching system, any use of can.batch.after needs to be part of the batch that it is trying to hook into.

can.batch.start();

// MAKE CHANGES
can.batch.after(function(){
  // do stuff when current batch has completed
})
can.batch.stop();

Previously, this would hook into the "last batch" which wasn't necessarily the batch that we actually might have just created.

Contributor

justinbmeyer commented Mar 5, 2016

Ok, I discovered the cause. With the new batching system, any use of can.batch.after needs to be part of the batch that it is trying to hook into.

can.batch.start();

// MAKE CHANGES
can.batch.after(function(){
  // do stuff when current batch has completed
})
can.batch.stop();

Previously, this would hook into the "last batch" which wasn't necessarily the batch that we actually might have just created.

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