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

Deprecate normalizePayload and normalizeHash #3437

Merged
merged 2 commits into from
Jun 30, 2015

Conversation

wecc
Copy link
Contributor

@wecc wecc commented Jun 24, 2015

I've duplicated the Ember.deprecate calls for normalizePayload to prevent the deprecation from being silent when users override normalizePayload and don't call super. The example in the docs doesn't even call super.

RESTSerializer does not override normalizePayload, that's why it's comparing with JSONSerializer.prototype.normalizePayload.

Closes #3428

@@ -1459,6 +1460,7 @@ var JSONSerializer = Serializer.extend({
@return {Object} json The deserialized payload
*/
extractSingle: function(store, typeClass, payload, id, requestType) {
Ember.deprecate('`serializer.normalizePayload` has been deprecated. Please use `serializer.normalizeResponse` with the new Serializer API to modify the payload.', this.normalizePayload === JSONSerializer.prototype.normalizePayload);
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit confusing, should we say extractSingle has been deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put the deprecation of normalizePayload here instead of inside the method since overriding would lose the deprecation. We're only displaying it if the user has overridden normalizePayload:

'...modify the payload.', this.normalizePayload === JSONSerializer.prototype.normalizePayload);

Copy link
Contributor

Choose a reason for hiding this comment

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

This is causing thousands of deprecations to be thrown for my application that has a large payload. The logging of all the deprecations is slow and the application load time is impacted. Before this change application load time was nearly instant. Now it is almost 10 seconds.

bmac added a commit that referenced this pull request Jun 30, 2015
…zeHash

Deprecate normalizePayload and normalizeHash
@bmac bmac merged commit 51f0fc1 into emberjs:release Jun 30, 2015
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.

4 participants