Keep computed value while reloading data


#1

Hi, I have a simple computed property that returns name from my user model. The problem is when the model is being reloaded, the value is empty for a moment. Is there a way to keep the old value till the new one is loaded?

// Computed property
userName: computed.alias('model.name')

// In template than super simple 
<h1>{{userName}}</h1>

// But when I do in code
model.reload();

// Then I get for a few milliseconds (basically it blinks) before the name is loaded again
<h1></h1>

#2

I can’t reproduce this behavior. When I try to do a similar setup, it has the behavior you want – the previous values stay on screen while the model is reloading.


#3

In general, if you want more fine-grained control over how things look in templates while promises are resolving, check out https://emberobserver.com/addons/ember-promise-helpers