-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Prevents autotracking ArrayProxy creation #17834
Merged
+143
−46
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,11 +111,11 @@ export default class ArrayProxy extends EmberObject { | |
this._arrangedContentRevision = value(this._arrangedContentTag); | ||
} | ||
|
||
this._addArrangedContentArrayObsever(); | ||
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. LOL @ this typo, I stared at this line for ~ 3 minutes trying to figure out why it was in the git diff 😝 |
||
this._addArrangedContentArrayObserver(); | ||
} | ||
|
||
willDestroy() { | ||
this._removeArrangedContentArrayObsever(); | ||
this._removeArrangedContentArrayObserver(); | ||
} | ||
|
||
/** | ||
|
@@ -251,16 +251,16 @@ export default class ArrayProxy extends EmberObject { | |
let arrangedContent = get(this, 'arrangedContent'); | ||
let newLength = arrangedContent ? get(arrangedContent, 'length') : 0; | ||
|
||
this._removeArrangedContentArrayObsever(); | ||
this._removeArrangedContentArrayObserver(); | ||
this.arrayContentWillChange(0, oldLength, newLength); | ||
|
||
this._invalidate(); | ||
|
||
this.arrayContentDidChange(0, oldLength, newLength); | ||
this._addArrangedContentArrayObsever(); | ||
this._addArrangedContentArrayObserver(); | ||
} | ||
|
||
_addArrangedContentArrayObsever() { | ||
_addArrangedContentArrayObserver() { | ||
let arrangedContent = get(this, 'arrangedContent'); | ||
if (arrangedContent && !arrangedContent.isDestroyed) { | ||
assert("Can't set ArrayProxy's content to itself", arrangedContent !== this); | ||
|
@@ -275,7 +275,7 @@ export default class ArrayProxy extends EmberObject { | |
} | ||
} | ||
|
||
_removeArrangedContentArrayObsever() { | ||
_removeArrangedContentArrayObserver() { | ||
if (this._arrangedContent) { | ||
removeArrayObserver(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Don’t we also need to add enumerable: false? Also, is caching important here?
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.
Ah, yes, I meant to do that!
For caching, I think it depends on how many times we expect folks to run
addArrayObserver
andremoveArrayObserver
, since nothing else really uses it in the ecosystem or the codebase. It seems like that's also a relatively uncommon thing, but we could also keep it as a CP if we're worried and useuntrack
to access it and prevent the issue.