tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.6k stars 193 forks source link

Fix issue with duplicate keys and last item. #398

Closed rwjblue closed 9 years ago

rwjblue commented 9 years ago

We are using renderState.handledMorphs as a way to know if a given key is duplicated or not (if it is duplicated we use a binning strategy to prevent errors), but we were setting handleMorphs[key] to null when the given morph was the last item in the list.

The fix is to keep renderAndCleanup and yieldItem using the same mechanism to know of the handled morphs (both should check via key in handledMorphs).

This is the fix for https://github.com/emberjs/ember.js/pull/11949.