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

add support for ember-data-model-fragments #28

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@jakesjews
Copy link

jakesjews commented Mar 26, 2019

Fix copying model fragments. Resolves #23

jakesjews added some commits Mar 26, 2019

@@ -154,14 +154,14 @@ export default Mixin.create({
) {
let value = this.get(name);

if (Copyable && Copyable.detect(value)) {
if ((Copyable && Copyable.detect(value)) || (value && value._isFragment)) {

This comment has been minimized.

Copy link
@offirgolan

offirgolan Apr 4, 2019

Owner

Are all model fragments copyable?

This comment has been minimized.

Copy link
@jakesjews

jakesjews Apr 4, 2019

Author

They are. For some reason Copyable.detect didn't seem to work.

// "value" is an Ember.Object using the ember-copy addon
// (ie. old deprecated Ember.Copyable API - if you use
// the "Ember Data Model Fragments" addon and "value" is a fragment or
// if use your own serializer where you deserialize a value to an
// Ember.Object using this Ember.Copyable API)
value = value.copy(deep);
} else {
} else if (value) {

This comment has been minimized.

Copy link
@offirgolan

offirgolan Apr 4, 2019

Owner

What is the reason for this change? Previously all values should be run through their transforms even if falsy. For example, you can have a vale of NaN that can have a custom transform to be Not a Number or 0, etc...

This comment has been minimized.

Copy link
@jakesjews

jakesjews Apr 4, 2019

Author

It's to prevent serializing a null fragment value since that throws an exception. I can change the check to make sure its not a fragment to prevent reaching this branch in that case.

This comment has been minimized.

Copy link
@offirgolan

offirgolan Apr 4, 2019

Owner

I can change the check to make sure its not a fragment to prevent reaching this branch in that case.

Yeah, I would rather the check be explicit.

@jakesjews

This comment has been minimized.

Copy link
Author

jakesjews commented Apr 10, 2019

Looks like the CI failure is from a new ember-data. I'm not quite sure if its from my changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.