ember-data-change-tracker
ember-data-change-tracker copied to clipboard
fix: fallback to localState when canonicalState is not present
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:


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.
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
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