question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cacheFor returns the wrong value for aliased properties

See original GitHub issue

Aliased properties (computed.alias, computed.readOnly, etc) return the CONSUMED object when you try to get their cached value.

ember-twiddle

export default Ember.Controller.extend({
  appName: 'Ember Twiddle',
  aliased: Ember.computed.alias('appName'),
  
  init() {
    this._super(...arguments);
    console.log('before:', this.cacheFor('aliased'));
    console.log('get:', this.get('aliased'));
    console.log('after:', this.cacheFor('aliased'));
  }
});

Expected output:

before: undefined
get: Ember Twiddle
after: Ember Twiddle

Actual output:

before: undefined
get: Ember Twiddle
after: Object {}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
dwickerncommented, Jul 25, 2017

Does public API ever distinguish between computed properties and aliases? They’re both created by Ember.computed. I assumed aliases are a special-case implementation for performance, but they should outwardly behave the same as computed properties

0reactions
lockscommented, May 31, 2019

@lolmaus according to https://github.com/emberjs/ember.js/issues/15545#issuecomment-317861212 it is working as expected and the issue is a misalignment of expectations. I mean that changing the behaviour of the API this late into the game can bring unexpected surprises.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add a system property - Product Documentation | ServiceNow
Set this field to false when you want to ensure all caches have the current property value. The true value causes the system...
Read more >
Business data alias cache configuration - IBM
If this property is set to its default value of false, all the processes are searched and the cache is loaded once with...
Read more >
NetSuite Applications Suite - URL Component Aliases
Enabling Order Email Messages in NetSuite Connector · Handling Inventory Items with Alias SKU · Viewing Inventory History in NetSuite ...
Read more >
Set map service properties—ArcMap | Documentation
This topic examines the properties that you can set for map services through the Service Editor in ArcMap. For a description of the...
Read more >
Configuring the Apollo Client cache - Apollo GraphQL Docs
It's sensitive to aliasing mistakes. It does nothing to protect against undefined object properties. Accidentally using different key fields at different times ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found