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 #316 polymorphic create fragment #483

Conversation

dwickern
Copy link
Contributor

@dwickern dwickern commented Feb 2, 2024

I fixed the merge conflicts from #436 and got it working with the new RecordData implementation.

Fixes #316
Closes #436

@dwickern dwickern marked this pull request as draft February 3, 2024 02:12
@dwickern
Copy link
Contributor Author

dwickern commented Feb 3, 2024

There seems to be a problem still with polymorphic values in fragmentArrays when using createRecord:

const zoo = store.createRecord('zoo', {
  star: { $type: 'lion' },
  animals: [{ $type: 'lion' }, { $type: 'elephant' }],
});
zoo.star instanceof Lion; // true ✅
zoo.animals.firstObject instanceof Lion; // false ❌
zoo.animals.lastObject instanceof Elephant; // false ❌

Edit: resolved by 15fac61

@dwickern dwickern force-pushed the fix-#316-polymorphic-create-fragment branch from d365032 to 576f118 Compare February 3, 2024 02:20
@dwickern dwickern marked this pull request as ready for review February 5, 2024 22:52
@dwickern dwickern force-pushed the fix-#316-polymorphic-create-fragment branch from a00fe7a to 15fac61 Compare February 5, 2024 22:55
@knownasilya
Copy link
Collaborator

@dwickern ready for review?

@dwickern
Copy link
Contributor Author

dwickern commented Feb 7, 2024

@knownasilya ready for review 👍

Copy link
Collaborator

@knownasilya knownasilya left a comment

Choose a reason for hiding this comment

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

Nice

@knownasilya knownasilya added the bug Used when the PR fixes a bug included in a previous release. label Feb 7, 2024
@knownasilya knownasilya merged commit e005411 into adopted-ember-addons:master Feb 7, 2024
7 of 11 checks passed
@dwickern dwickern deleted the fix-#316-polymorphic-create-fragment branch February 7, 2024 18:09
@dwickern
Copy link
Contributor Author

@knownasilya any plans to release this fix?

@knownasilya
Copy link
Collaborator

@dwickern released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used when the PR fixes a bug included in a previous release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FragmentArray.createFragment should respect type in polymorphic arrays
3 participants