Skip to content

Deprecate Array Observers#692

Merged
rwjblue merged 3 commits intomasterfrom
deprecate-array-observers
Jan 15, 2021
Merged

Deprecate Array Observers#692
rwjblue merged 3 commits intomasterfrom
deprecate-array-observers

Conversation

@pzuraq
Copy link
Contributor

@pzuraq pzuraq commented Dec 23, 2020


- While array observers are not used commonly in public code, they are used by
several commonly used addons, such as `ember-collection`,
`ember-data-model-fragments`, and `ember-light-table`. Deprecating them will
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to mention ember-data here? Seems like this might be an intermediate refactor for hasMany objects.

https://github.com/emberjs/data/blob/623145d0009d683a50468ba9961431ae76ae6df6/packages/model/addon/-private/system/many-array.js#L164

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calling arrayContentWillChange and arrayContentDidChange is how an EmberArray triggers array observers. Internally, Ember Data does not rely on array observers at all, but it must call these methods in case others are using them.

This is a good point though, in that it's a similar situation to the one we're facing with implicit injections, Ember Data cannot remove these method calls until there are no more users, which means they cannot immediately comply with a deprecation. So, I think we should make it a phased deprecation, where arrayContentWillChange and arrayContentDidChange are fully deprecated in the next major version after array observers themselves are deprecated and removed.

@rwjblue
Copy link
Member

rwjblue commented Jan 8, 2021

Moving into FCP

}

objectAtContent() {
return this._content.objectAt(index);
Copy link

Choose a reason for hiding this comment

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

index is not defined here.

@rwjblue rwjblue merged commit 68be337 into master Jan 15, 2021
@rwjblue rwjblue deleted the deprecate-array-observers branch January 15, 2021 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants