You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a viewmodel wich I reuse with other models. Normally it works fine but I found a issue when updating the model within the viewmodel. The viewModel has a computed on Type, this computed changes indirectly another observable Operator. The problem is that when type is assigned a new model (new emmiter) it notifies its subscribers and thereby changes Operator, however Operator hasn't been updated to the new model yet causing it to change the old model.
For now I solved it by changing the order of defaults in the Backbone model, but this is not a permanent solution. I was wondering if there is a better method for this? I think it should wait to notify the subscribers until all observables are set to the new model.
The text was updated successfully, but these errors were encountered:
RikSlendebroek
changed the title
Assigning new model to viewmodel updates properties
Assigning new model to viewmodel updates properties of wrong model
Mar 12, 2018
I have a viewmodel wich I reuse with other models. Normally it works fine but I found a issue when updating the model within the viewmodel. The viewModel has a computed on Type, this computed changes indirectly another observable Operator. The problem is that when type is assigned a new model (new emmiter) it notifies its subscribers and thereby changes Operator, however Operator hasn't been updated to the new model yet causing it to change the old model.
Example js:
Example html:
For now I solved it by changing the order of defaults in the Backbone model, but this is not a permanent solution. I was wondering if there is a better method for this? I think it should wait to notify the subscribers until all observables are set to the new model.
The text was updated successfully, but these errors were encountered: