Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show test failing with hasChangedAttributes #383

Conversation

GuillaumeCisco
Copy link

No description provided.

@GuillaumeCisco GuillaumeCisco changed the title show test failing with hasChangedAttrbiutes show test failing with hasChangedAttributes Oct 26, 2020
@patocallaghan
Copy link
Contributor

@GuillaumeCisco Apologies I was on vacation for the last week. I wonder if you could put your potential dummy fix in this PR too and maybe update the description? If anything to generate discussion about how to properly fix it. I don't know a whole lot about the internals of RecordData but we can ping the relevant folks to get them to look

@@ -140,20 +140,25 @@ module('unit - `MF.fragmentArray` property', function(hooks) {
region: 'Crownlands',
country: 'Westeros'
});
assert.deepEqual(person.changedAttributes().addresses, undefined, 'a frehsly pushed object has no changes');
assert.deepEqual(person.changedAttributes().addresses, undefined, 'a freshly pushed object has no changes');
assert.ok(!person._internalModel.hasChangedAttributes(), 'a freshly pushed object has no changed attributes');
Copy link
Contributor

@patocallaghan patocallaghan Nov 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does person.hasDirtyAttributes give us the same results as person._internalModel.hasChangedAttributes()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even know. I think it should by reading the documentation
But hasChangedAttributes is an internal method, and this is the one we need to update for fixing the bug in my case.
As hasChangedAttributes will be called as I developed it in earlier post.

@GuillaumeCisco
Copy link
Author

@GuillaumeCisco Apologies I was on vacation for the last week. I wonder if you could put your potential dummy fix in this PR too and maybe update the description? If anything to generate discussion about how to properly fix it. I don't know a whole lot about the internals of RecordData but we can ping the relevant folks to get them to look

The PR with the fix can be found on my fork here: GuillaumeCisco#1
In fact, it looks like to me hasChangedAttributes has never been correctly handled... It looks like a copy/paste from the original ember-data.
I don't know neither about how works RecordData so I cannot provide a smarter fix, help is welcome here :)

@patocallaghan
Copy link
Contributor

@GuillaumeCisco I think we can close this PR. It appears that the fix in #381 makes the test you created here pass. They also include a fix with their test.

@patocallaghan
Copy link
Contributor

The fix from #381 has been released in v5.0.0-beta.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants