aurelia / templating-binding

An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.
MIT License
32 stars 26 forks source link

Nested repeat.for on two arrays causes uncaught TypeError / Repeat.items set to null #78

Closed vuorinem closed 8 years ago

vuorinem commented 8 years ago

Reproduce: http://plnkr.co/edit/3JaZYJbOv5dkO2y5P0vl

Binding a nested repeat.for with two different arrays of size 5 or more, then clearing the array and re-adding items, causes Repeat.items being set to null and throws Uncaught TypeError: Cannot read property 'length' of null.

Template:

<table>
  <tbody>
    <tr repeat.for="r of rows">
      <td repeat.for="c of cols">
        (${r.l},${c.l})
      </td>
    </tr>
  </tbody>
</table>

@jsobell It appears to be related to the ModifyArrayObserver that gets added to the outer array

jsobell commented 8 years ago

Also reversing the order in which variables 'rows' and 'cols' have values pushed changes the error:

  this.rows.push(i);
  this.cols.push(i);

is different to

  this.cols.push(i);
  this.rows.push(i);

This transfers the null error from one repeat to the other.

jdanyow commented 8 years ago

thanks for the plunker and steps!

jdanyow commented 8 years ago

still an issue in latest build https://gist.run/?id=a2250b2a73da073a7a56