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

fix: fallback to localState when canonicalState is not present #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eyupatis
Copy link

@eyupatis eyupatis commented Jul 30, 2022

We were using Ember 3.15 in one of our projects and ember-data-change-tracker was working perfectly. When we upgraded our application to Ember 3.28(LTS) version, the addon stopped tracking the changes on belongsTo relationships.

At first, I was guessing the problem could be related to the addon's Ember version. When I upgraded the addon's Ember version to 3.28, it didn't solve the problem.

Then I dig deeper and saw that it was happening because of not having canonicalState attribute on belongsTo relationships. Instead, we have localState and remoteState attributes.

In order to make the fix backward compatible, I kept canonicalState as the first option and if we don't have it, we fall back to localState.

Here are the debugger outputs to explain the situation even better:

Screen Shot 2022-07-30 at 22 32 26

Screen Shot 2022-07-30 at 22 33 04

With this PR, we are making this addon compatible with Ember 3.28 and probably newer versions of Ember.

@danielspaniel Let me know if you see any problems with the PR. I would be happy to address the problems and help further.

@danielspaniel
Copy link
Owner

Interesting @eyupatis, I have switched to the clojure ecosystem a few years ago, so I have not been involved with ember + change tracker anymore.
If I merge this I then have to make new version, etc. Let me ponder

@sly7-7
Copy link

sly7-7 commented Oct 4, 2022

I had to do this change too, but as @runspired advised on discord, it seems like using remoteState is the 'right' move.
see: https://discord.com/channels/480462759797063690/490216705122107427/970796099432480869
Capture d’écran 2022-10-04 à 10 02 43

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.

3 participants