Skip to content

Commit

Permalink
Bugfix: don't remove jobs if name doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Feb 7, 2025
1 parent a649eb0 commit 4c21ecd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugins/jobs-management/src/JobsListWidget/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ export function stateModelFactory(_pluginManager: PluginManager) {
*/
removeJob(jobName: string) {
const indx = self.jobs.findIndex(job => job.name === jobName)
const removed = self.jobs[indx]
self.jobs.splice(indx, 1)
return removed
if (indx === -1) {
return undefined
}
const removed = self.jobs.splice(indx, 1)
return removed[0]
},
/**
* #action
Expand Down Expand Up @@ -110,9 +112,11 @@ export function stateModelFactory(_pluginManager: PluginManager) {
*/
removeQueuedJob(jobName: string) {
const indx = self.queued.findIndex(job => job.name === jobName)
const removed = self.queued[indx]
self.queued.splice(indx, 1)
return removed
if (indx === -1) {
return undefined
}
const removed = self.queued.splice(indx, 1)
return removed[0]
},
/**
* #action
Expand Down

0 comments on commit 4c21ecd

Please sign in to comment.