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 Object.linkingObjects() across different classes #6108

Merged
merged 9 commits into from
Aug 30, 2023
Merged

Conversation

elle-j
Copy link
Contributor

@elle-j elle-j commented Aug 29, 2023

What, How & Why?

When calling Object.linkingObjects() on an object linking to an object of a different object type, the following error would be generated:

<linking object type>#<linking property> is not a relationship to '<object type>'

// Example
Manufacturer#cars is not a relationship to 'Car'

Our assertion in the Object.linkingObjects() API has been corrected as well as the collectionHelpers passed when instantiating the returned Results. (It previously used the collectionHelpers from the targetProperty rather than target itself.)

Note:

  • Previously existing tests were using linking objects of the same object type, thus the bug was not detected.

☑️ ToDos

  • 📝 Changelog entry
  • 🚦 Tests

@elle-j elle-j requested review from takameyer and kneth August 29, 2023 14:27
@cla-bot cla-bot bot added the cla: yes label Aug 29, 2023
Copy link
Contributor

@takameyer takameyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great fix!

CHANGELOG.md Outdated Show resolved Hide resolved
packages/realm/src/Object.ts Outdated Show resolved Hide resolved
packages/realm/src/Object.ts Outdated Show resolved Hide resolved
@elle-j elle-j force-pushed the lj/linking-objects branch from a958595 to 5c3f9d6 Compare August 29, 2023 15:16
@elle-j elle-j merged commit 0a37bbf into main Aug 30, 2023
@elle-j elle-j deleted the lj/linking-objects branch August 30, 2023 06:04
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants