-
Notifications
You must be signed in to change notification settings - Fork 286
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
Improve proxies #1053
Improve proxies #1053
Changes from all commits
ee6464a
c8d5569
714ef9e
0273cfe
d108f9d
6529ede
45a56fc
3f11111
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,6 +557,13 @@ export default EmberObject.extend(PortMixin, { | |
*/ | ||
mixinDetailsForObject(object) { | ||
const mixins = []; | ||
if (object instanceof Ember.ObjectProxy && object.content && !object._showProxyDetails) { | ||
return this.mixinDetailsForObject(object.content); | ||
} | ||
|
||
if (object instanceof Ember.ArrayProxy && object.content && !object._showProxyDetails) { | ||
return this.mixinDetailsForObject(object.slice(0, 101)); | ||
} | ||
|
||
const own = ownMixins(object); | ||
|
||
|
@@ -1095,6 +1102,9 @@ function getDebugInfo(object) { | |
let debugInfo = null; | ||
let objectDebugInfo = get(object, '_debugInfo'); | ||
if (objectDebugInfo && typeof objectDebugInfo === 'function') { | ||
if (object instanceof Ember.ObjectProxy && object.content) { | ||
object = object.content; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if maybe we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but the new ember data debugInfo does not do it... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @patricklx can you elaborate on that? Perhaps @runspired can help? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean we use Ember.get here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I wouldn't call this "new", its been around a long time and it's something we'd love to delete :P Reaching through the proxy for the content seems wise here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmm, right... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, same issue, so might have never worked with belongTo relations :) |
||
} | ||
// We have to bind to object here to make sure the `this` context is correct inside _debugInfo when we call it | ||
debugInfo = objectDebugInfo.bind(object)(); | ||
} | ||
|
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.
What is this
slice
for?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.
it does the same as
toArray()
, so it obtains the correct items from e.g. ember data many-array but only for the first 101 items, (though this should actually be part of the perf PR). otherwise it would callobjectAt
for all items in many-array