fix: fallback to localState when canonicalState is not present #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 onbelongsTo
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 onbelongsTo
relationships. Instead, we havelocalState
andremoteState
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 tolocalState
.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.