Closed usamahamed closed 3 years ago
I'm facing this issue too:
ember-changeset: v3.13.1
changeset-validations: v3.14.2
ember-source: v3.16.10
Noticed this doesn't happend in another ember app with ember v3.20.6
An easy way to repro
let model = new Changeset({ age: '10'});
model.set('age', '80');
model.set('age', '10') //starting value
model.set('age', '90'); //ignored from now on
Thank you! I'll see if I can fix tomorrow
Let me know if I can help you with anything
@betocantu93 Here is a test I wrote up. It seems everything is working. Did I miss anything?
it('#set works', () => {
const expectedChanges = [{ key: 'age', value: '90' }];
let dummyChangeset = Changeset({ age: '10' });
dummyChangeset.set('age', '80');
dummyChangeset.set('age', '10');
dummyChangeset.set('age', '90');
const changes = dummyChangeset.changes;
expect(dummyModel.age).toBeUndefined();
expect(dummyChangeset.get('age')).toEqual('90');
expect(changes).toEqual(expectedChanges);
expect(dummyChangeset.isDirty).toBe(true);
expect(dummyChangeset.change).toEqual({ age: '90' });
});
Hey, it should be showing the error 🤔 here's a repro https://github.com/betocantu93/changeset-bug, with the exact same deps I have on this app
@betocantu93 Looks like v3.13.1
is working with this test! I just merged in a PR with this test added. Perhaps you have to update versions?
Yes, maybe I need to update versions... was trying to avoid it to be honest, but this is the way! thanks!
I just want to comment for anyone else landing here: this bug exists from ember-source 3.16.x
to 3.19.x
, from 3.20+ works
It's not related to changeset but to ember itself.
Version
v3.9.2
Test Case
If you change something in the changeset model, the
isDirty
flag is set to true and if you remove it again it will set to false and if you try to add new changes it will be ignoredSteps to reproduce
I have a model and this model has a
label
and type isstring
1- Add some letter beside the label and then ember will trigger the
isDirty
flag to indicate that model has changes 2- Remove the the letter i added beside the label, theisDirty
flag set to be false again 3- Try to enter any new changes which called set model, it ignores the changesThe changes ignore inside the
_run
method in thebackburner.js
Expected Behavior
if i add and delete and add, it should trigger the changes and update the model with the new changes
Actual Behavior
it doesn't update the model with
set
after add then delete then add again