poteto / ember-changeset

Ember.js flavored changesets, inspired by Ecto

Home Page:http://bit.ly/ember-changeset-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changeset changes array is not cleared when no changes exist

jeroen-hoekstra opened this issue · comments

Version

3.13.2

Test Case

https://github.com/jeroen-hoekstra/ember-changeset-issue

Steps to reproduce

After updating ember-changeset from 3.12.0 to 3.13.2 we noticed a difference in change tracking. Not sure if this is intended behaviour. You can run my test case with both versions and check the logs.

Open de console and notice that on page load the changeset changes array is empty. Initialy the hidden property is false. Toggle the first toggle so the hidden property becomes true. We see that the changeset changes array now contains the change object. When toggling it again the changeset changes array should become empty again, as the hidden property becomes equal to it's initial value, which is false. This was the case with version 3.12.0 but with 3.13.2 the changeset changes array still contains the change object, but with it's value set to false.

Expected Behavior

Version 3.12

Screenshot from 2021-03-22 09-47-11

Actual Behavior

Version 3.13.2

Screenshot from 2021-03-22 09-49-36

Here's a fix using #586 spike. It has a few issues to be solved over there, but... it proves(?) it fix this.

https://github.com/betocantu93/ember-changeset-issue