diff --git a/.changelog/23492.txt b/.changelog/23492.txt new file mode 100644 index 000000000..e6538f39e --- /dev/null +++ b/.changelog/23492.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix an issue where a remotely purged job would prevent redirect from taking place in the web UI +``` diff --git a/ui/app/controllers/jobs/job.js b/ui/app/controllers/jobs/job.js index f1212e764..393ee2565 100644 --- a/ui/app/controllers/jobs/job.js +++ b/ui/app/controllers/jobs/job.js @@ -23,20 +23,27 @@ export default class JobController extends Controller { return this.model; } - @action notFoundJobHandler() { + @action async notFoundJobHandler() { if ( this.watchers.job.isError && this.watchers.job.error?.errors?.some((e) => e.status === '404') ) { - this.notifications.add({ - title: `Job "${this.job.name}" has been deleted`, - message: - 'The job you were looking at has been deleted; this is usually because it was purged from elsewhere.', - color: 'critical', - sticky: true, - }); - this.store.unloadRecord(this.job); - this.router.transitionTo('jobs'); + try { + this.notifications.add({ + title: `Job "${this.job.name}" has been deleted`, + message: + 'The job you were looking at has been deleted; this is usually because it was purged from elsewhere.', + color: 'critical', + sticky: true, + }); + await this.router.transitionTo('jobs'); + this.store.unloadRecord(this.job); + } catch (err) { + if (err.code === 'TRANSITION_ABORTED') { + return; + } + throw err; + } } } }