diff --git a/.changelog/12315.txt b/.changelog/12315.txt new file mode 100644 index 0000000000..5455912743 --- /dev/null +++ b/.changelog/12315.txt @@ -0,0 +1,4 @@ +```release-note:bug +ui: Fix up a problem where occasionally an intention can +visually disappear from the listing after saving +``` diff --git a/ui/packages/consul-ui/app/services/repository.js b/ui/packages/consul-ui/app/services/repository.js index 4a441f403a..0b0df8e085 100644 --- a/ui/packages/consul-ui/app/services/repository.js +++ b/ui/packages/consul-ui/app/services/repository.js @@ -26,7 +26,7 @@ export const softDelete = (repo, item) => { repo.getModelName() ); return res; -} +}; export default class RepositoryService extends Service { @service('store') store; @service('env') env; @@ -116,7 +116,12 @@ export default class RepositoryService extends Service { if (typeof meta.date !== 'undefined') { this.store.peekAll(this.getModelName()).forEach(item => { const date = get(item, 'SyncTime'); - if (!item.isDeleted && typeof date !== 'undefined' && date != meta.date && this.shouldReconcile(item, params)) { + if ( + !item.isDeleted && + typeof date !== 'undefined' && + date != meta.date && + this.shouldReconcile(item, params) + ) { this.store.unloadRecord(item); } }); @@ -156,12 +161,12 @@ export default class RepositoryService extends Service { try { res = await this.store.query(this.getModelName(), params); meta = res.meta; - } catch(e) { - switch(get(e, 'errors.firstObject.status')) { + } catch (e) { + switch (get(e, 'errors.firstObject.status')) { case '404': case '403': meta = { - date: Number.POSITIVE_INFINITY + date: Number.POSITIVE_INFINITY, }; error = e; break; @@ -169,10 +174,10 @@ export default class RepositoryService extends Service { throw e; } } - if(typeof meta !== 'undefined') { + if (typeof meta !== 'undefined') { this.reconcile(meta, params, configuration); } - if(typeof error !== 'undefined') { + if (typeof error !== 'undefined') { throw error; } return res; @@ -210,6 +215,7 @@ export default class RepositoryService extends Service { item.execute(); item = item.data; } + set(item, 'SyncTime', undefined); return item.save(); }