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

[BUGFIX beta] Don't unnecessarily materialize records #4272

Merged
merged 1 commit into from
Oct 21, 2016
Merged

[BUGFIX beta] Don't unnecessarily materialize records #4272

merged 1 commit into from
Oct 21, 2016

Conversation

pangratz
Copy link
Member

@pangratz pangratz commented Mar 28, 2016

This adds a store#_push method which returns DS.InternalModel's
instead of materialized DS.Model instances. This allows us to defer the
materialization process of an InternalModel until the corresponding
record is actually needed.


if (inverseRecord && inverseRecord.isLoaded()) {
return inverseRecord.getRecord();
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This or #4271 needs to be updated, depending on which is merged first.

@bmac
Copy link
Member

bmac commented May 3, 2016

Looks good @pangratz. 👍

@pangratz
Copy link
Member Author

pangratz commented May 9, 2016

@igorT can you take a look at this PR and check if this is what you had in mind?

@param {Object} data
@return {DS.InternalModel|Array} pushed InternalModel(s)
*/
_push(data) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we name this to refer to internalModel somehow

Copy link
Member Author

Choose a reason for hiding this comment

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

Struggling to find a better name here, any suggestions? _shallowPush or _lightweightPush? Because _pushInternalModel doesn't sound right to me...

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you think of making this a public method pushRef or something, which returns RecordReference(s)? I think @fivetanley you were mentioning something like that somewhere?

Copy link
Member

Choose a reason for hiding this comment

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

ping @igorT. I believe @pangratz is looking for some feedback here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've created RFC#161 to get a discussion on the store.pushRef going...

This adds a `store#_push` method which returns DS.InternalModel's
instead of materialized DS.Model instances. This allows us to defer the
materialization process of an InternalModel until the corresponding
record is actually needed.
@igorT igorT merged commit dbf7db4 into emberjs:master Oct 21, 2016
@pangratz pangratz deleted the internal-store-push branch October 21, 2016 19:33
@pangratz
Copy link
Member Author

👯‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants