Ember: Suggestions welcome to handle inFlight errors

I am using Ember data with a REST adapter. I want to make sure that in case of slow server responses the application is not subject.

I simulated this bij by adding a server-side sleep method in 5 seconds before returning a JSON response.

If you have a form with the SAVE button, and you press this button while the previous save is still happening, you get an inFlight error and the entire Ember application freezes (the only thing you can do is restart the application). This way you can easily disable the save button by checking the isSaving state:

<button {{action 'save'}} {{bindAttr disabled="isSaving"}}>Save</button>

Now it also seems that when you change the form field when the previous save is still happening, you get an inFlight error. This, therefore, indicates that I also need to disable the full form.

Uncaught Error: Attempted to handle event `willSetProperty` on 
<App.Author:ember477:5203e34599808d1c6c000001> while in state 
rootState.loaded.updated.inFlight. Called with {reference: [object Object], store: 
<App.Store:ember541>, name: name} 

Is there any good practice to handle these cases ... I want to prevent that I need to add a lot of logic (disable buttons, set fields for reading, etc.) for these cases of edges.

+1
source share
1 answer

This may not be within the scope of what you are trying to do, but the Ember Persistence Foundation is designed to update your models while rescue is still in flight.

EPF, , . " Ember" .

+2

All Articles