In production builds, certain fragment array mutations produce the wrong result. For example, this code swaps the first two items in the array:
const first = fragmentArray.objectAt(0)
fragmentArray.removeAt(0)
fragmentArray.insertAt(1, first)
In development, this works as expected. But in a production build, this code results in the first item being duplicated (as if the removeAt did not happen).
There are already some failing tests for this issue, as long as we run the tests in production mode:
not ok 19 Chrome 124.0 - [23 ms] - integration - Dependent State: reordering a fragment array dirties the fragment array and owner record
---
actual: >
3
expected: >
2
stack: >
at Object.<anonymous> (http://localhost:7357/assets/tests-28c38f66d4715374e954e49f4d4e8a30.js:39:22)
message: >
fragment array length is maintained
negative: >
false
browser log: |
...
not ok 110 Chrome 124.0 - [23 ms] - unit - `MF.fragmentArray`: changes to array contents change the fragment array `hasDirtyAttributes` property
---
actual: >
false
expected: >
true
stack: >
at Object.<anonymous> (http://localhost:7357/assets/tests-28c38f66d4715374e954e49f4d4e8a30.js:306:193)
message: >
fragment array is returned to clean state
negative: >
false
browser log: |
...
Some of the existing tests depend on Ember.assert throwing an exception. To make this work in production mode, I've replaced assert.throws with expectAssertion, which is similar to ember-qunit-assert-helpers and to ember's own expectAssertion helper.
In production builds, certain fragment array mutations produce the wrong result. For example, this code swaps the first two items in the array:
In development, this works as expected. But in a production build, this code results in the first item being duplicated (as if the
removeAt
did not happen).There are already some failing tests for this issue, as long as we run the tests in production mode:
Some of the existing tests depend on
Ember.assert
throwing an exception. To make this work in production mode, I've replacedassert.throws
withexpectAssertion
, which is similar to ember-qunit-assert-helpers and to ember's own expectAssertion helper.