ui: Replaces destroyRecord with unloadRecord for KV 404's (#5837)

Just because Consul gives us a 404 this doesn't guarantee the KV doesn't
exist, it doesn't even mean we don't have access to it. Furthermore we
should never destroyRecord's without user interaction (therefore only via the
repo.delete method).

This switches destroyRecord to unloadRecord which performs the
additional legwork to keep ember-data in sync with the actual truth.

unloadRecord unloads the record from ember-data rather than sending an API
delete request, which would have been the intent here.
This commit is contained in:
John Cowen 2019-06-04 15:56:20 +01:00 committed by GitHub
parent 75e221d256
commit 8306b2f251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ export default RepositoryService.extend({
const id = JSON.stringify([dc, key]);
const record = get(this, 'store').peekRecord(this.getModelName(), id);
if (record) {
record.destroyRecord();
record.unloadRecord();
}
}
throw e;