@benoror wrote:
I have a use case where a Model has a JSON attribute used for arbitrary configurations:
configuration: DS.attr()
.I have a
configurationService
(initialized in every component/route/controller/…) with computed properties for easily retrieving this configurations throughout the applicationSince the JSON configurations are quite large & have variable depth I can’t have a computed property for every single one.
Unfortunately, being the Service a singleton computed properties don’t detect the changes in the JSON keys (a.k.a. deep watch).
I there a way to force deep watching a JSON attribute?Example: I have the following computed property in my service:
profile: Ember.computed('configuration.profile', function() { return this.get('configuration.profile'); });
Considering the configuration object was:
{configuration: {profile: {show_birthday: false}}}
, if I somehow changeshow_birthday
totrue
, it won’t be detected
- Note: I considered https://github.com/lytics/ember-data-model-fragments but discarded it since it’s too verbose, the issue is that our
configuration
object can become quite large and deep, dynamic & unpredictable- I tried
computed.alias
as well with no success.Any hints or alternatives would be appreciated
Posts: 2
Participants: 2