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] Fix development build relationship caching. #5332

Merged
merged 1 commit into from
Jan 27, 2018

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Jan 22, 2018

The previous implementation was intending to cache relationships when in the production environment, but avoid caching them in development. Unfortunately, this code was factored in a way that relied on mutating internal private state of the underlying Ember.ComputedProperty instance when Ember.testing was true (which was used as a way to determine prod vs non-prod).

When this code was introduced (2014-12-02 in #2530), setting _cacheable on a ComputedProperty instance would have worked as intended, however a refactor in Ember (ironically one day prior in emberjs/ember.js#9489, but on Ember's canary channel) deprecated using _cacheable or .cacheable() (in favor of opting out of caching via .volatile()). Later support for _cacheable was completely removed in emberjs/ember.js#12036 leading up to Ember 2.0.0.

This PR refactors the code a bit, so that we no longer need to mutate the computed property after creation and allows us to avoid some gnarliness...

@rwjblue
Copy link
Member Author

rwjblue commented Jan 22, 2018

Much easier to review with: https://github.com/emberjs/data/pull/5332/files?w=1

Copy link
Contributor

@runspired runspired left a comment

Choose a reason for hiding this comment

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

On second thought, it's likely better to just drop the volatile portion of this commit entirely, since this hasn't worked since before ember 2.x and would have been a dubious behavior even when it did function as intended.

@rwjblue rwjblue force-pushed the fix-relationship-caching branch 4 times, most recently from 27fcef2 to cc0ee04 Compare January 22, 2018 22:01
The previous implementation was intending to cache relationships when in
the production environment, but avoid caching them in development.
Unfortunately, this code was factored in a way that relied on mutating
internal private state of the underlying `Ember.ComputedProperty`
instance when `Ember.testing` was true (which was used as a way to
determine prod vs non-prod).

When this code was introduced (2014-12-02), setting `_cacheable` on a
`ComputedProperty` instance would have worked as intended, however a
refactor in Ember (ironically one day prior, but on Ember's canary
channel) deprecated using `_cacheable` or `.cacheable()` (in favor of
opting out of caching via `.volatile()`).

Since this has not worked since Ember 2.0.0, and it has not been an
issue, this commit completely removes the manual caching / volatile
swapping between prod/dev/testing environments.
@rwjblue rwjblue merged commit b8f980b into emberjs:master Jan 27, 2018
@rwjblue rwjblue deleted the fix-relationship-caching branch January 27, 2018 21:44
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