Skip to content

Instantly share code, notes, and snippets.

@thomaswrenn
Created September 27, 2017 01:51
Show Gist options
  • Save thomaswrenn/dc68d32c9a8f7be8529c94e57a004165 to your computer and use it in GitHub Desktop.
Save thomaswrenn/dc68d32c9a8f7be8529c94e57a004165 to your computer and use it in GitHub Desktop.

Doesn't trigger the computed on page load or update (tested in a controller):

const { computed, get, inject } = Ember;
import { getFeatureFlags } from 'vishnu/sagas/selectors';

export default Ember.Component.extend({
  reduxStore: inject.service('saga-store'),
  featureFlags: computed('reduxStore.state', function() {
    return getFeatureFlags(get(this, 'reduxStore.state'));
  }),

  isFeatureFlagOn: computed('featureFlags', function() {
    console.log('changed!');
    return this.get('featureFlags.featureFlag');
  }),
});

Doesn't trigger the computed on page load or update (tested in a controller):

const { computed, get, inject } = Ember;

export default Ember.Component.extend({
  featureFlags: inject.service(),

  isFeatureFlagOn: computed('featureFlags', function() {
    console.log('changed!');
    return this.get('featureFlags.featureFlag');
  }),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment