Say I am trying to save a Foo record to the back-end. For whatever reason, the back-end never returns (neither success nor failure).
From what I can see, it looks like foo stays in the "in flight" state. The problem with this state is it completely locks the record - you can't do anything on it (can't rollback, can't unload). I understand why it is like that (to try and keep things consistent). But is there something you can do about an edge case like this?
I've not tried this but you might find a solution by looking at ember-data's source code, specifically states.js: https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/model/states.js#L306-L351
Not sure there is a solid best practice here, but my best guess is that you can recover by sending becameInvalid
to the model's stateManager.
Building on Mike's suggestion, I ended up with the following:
record.send('becameInvalid');
record.unloadRecord();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With