ciena-frost / ember-frost-bunsen

Create UIs from JSON configurations
http://ciena-frost.github.io/ember-frost-bunsen/
MIT License
20 stars 35 forks source link

Fix re-ordering issues with Ember each #552

Closed sophypal closed 6 years ago

sophypal commented 6 years ago

PATCH

The scenario that resulted in this weird behavior is when a condition involves a view layout where you have one field alongside other fields. Lets call the one field foo and call the others others. foo is a single field. others contain multiple fields. The way the view is laid out makes others use a key that represents the index while the foo field uses a key that matches the content. One is a number and the other is a string.

When conditions are involved, it'll toggle which field is displayed and the resulting keys being used change to match the new layout. We often end up with a scenario where there is a type mismatch with adjacent cells and 0 is used. This breaks the each functionality and instead of Ember re-ordering the DOM to match the rendered order of the component, it craps out and just appends it to the end. The fix involved forcing the keys to always be strings.

I would love to add tests for this but just testing this by hand was cumbersome so I'll leave it out for this PR.

CHANGELOG