-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUGFIX release] createRecord should only setup relationships it has … #5048
Conversation
c6485ee
to
d52c3e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; a minor assertion cleanup that would be nice but the change itself is 👍
let book = store.createRecord('book', { name: 'The Greatest Book' }); | ||
let relationship = book._internalModel._relationships.get('author'); | ||
|
||
assert.equal(relationship.hasData, false, 'relationship has data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertion message is wrong: relationship does not have data
}); | ||
|
||
let relationship = book._internalModel._relationships.get('author'); | ||
assert.equal(relationship.hasData, false, 'relationship has data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see ^
let page = store.createRecord('page'); | ||
|
||
let relationship = chapter._internalModel._relationships.get('pages'); | ||
assert.equal(relationship.hasData, false, 'relationship has data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see ^
let chapter = store.createRecord('chapter', { title: 'The Story Begins' }); | ||
let relationship = chapter._internalModel._relationships.get('pages'); | ||
|
||
assert.equal(relationship.hasData, false, 'relationship has data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see ^
d7280b8
to
db42a28
Compare
db42a28
to
f741f34
Compare
f741f34
to
8628f2a
Compare
did a rebase now, seems to be blocked by: SyntaxError: ember-data/adapters/json-api.js: @ember/debug does not have a deprecate import
7 | import RESTAdapter from "./rest";
8 | import { isEnabled } from '../-private';
> 9 | import { deprecate } from '@ember/debug';
| ^
10 | import { instrument } from 'ember-data/-debug'; @rwjblue is investigating. |
605fcae
to
8628f2a
Compare
@runspired r? |
LGTM |
@bmac got cycles for a backport + release? (I'm currently on vacation, but if you don't have cycles I can handle it) |
@stefanpenner I'm on it. |
Released as 2.14.4. |
@bmac awesome thanks dude, you rock! |
…data for
relationships should in theory now only be accessed if they are used (
set
orget
). This should mitigate the large number of test failures see during upgrade due to todata/addon/-private/system/relationships/state/create.js
Line 20 in e6cb564
If this doesn't actually fix the issue in enough cases, we can always turn that assert into a warn or something. But I would love a failing test for the exact case that remains (if one exists) to be 100% sure. As I would prefer to not loose a good assertion unless we must.