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

Is the idea behind how copy by reference done still valid #18

Open
onumossn opened this issue Feb 14, 2018 · 4 comments
Open

Is the idea behind how copy by reference done still valid #18

onumossn opened this issue Feb 14, 2018 · 4 comments

Comments

@onumossn
Copy link
Contributor

Is https://github.com/offirgolan/ember-data-copyable/blob/master/addon/mixins/copyable.js#L192 still valid with 2.18.1? I am running into an issue where, if I copy something with a relationship and unload it, it will be in a weird state and remove one side of the relationship while maintain the other on the originals.

@offirgolan
Copy link
Owner

Yeah the logic should still be valid. Can you breakpoint here or here and see if those lines are getting hit in your app?

@onumossn
Copy link
Contributor Author

Those lines get hit. I was imagining that the method used to unload may have changed in a way that would cause copying references in that manner to cause the models to get into a bad state.

@offirgolan
Copy link
Owner

Can you replicate this issue with an earlier version of this addon?

@mupkoo
Copy link

mupkoo commented Aug 28, 2018

There is a chance that this is more related to Ember Data and unloading records. Here I will quote Chris Thoburn (runspired), who explained this to me recently.

unloadRecord has a few different behaviors depending on the nature of the relationships the record has, but the easiest way of conceptualizing it is “treat as if not loaded”.

  • for sync relationships we consider this to be a true-state deletion
  • for async relationships we mark the relationship as needing to be reloaded
  • for records with no relationships, we eliminate the record from the cache

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

No branches or pull requests

3 participants