Skip to content

Commit

Permalink
More changes to cancel run modal
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Jul 31, 2024
1 parent 6d0fccf commit 9b5ccf6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function ConfirmCancelRunModal({
isLoading: isDismissing,
} = useDismissCurrentRunMutation({
onSuccess: () => {
if (isQuickTransfer) {
if (isQuickTransfer && !isActiveRun) {
deleteRun(runId)
}
},
Expand Down Expand Up @@ -87,8 +87,8 @@ export function ConfirmCancelRunModal({
React.useEffect(() => {
if (runStatus === RUN_STATUS_STOPPED) {
trackProtocolRunEvent({ name: ANALYTICS_PROTOCOL_RUN_ACTION.CANCEL })
dismissCurrentRun(runId)
if (!isActiveRun) {
dismissCurrentRun(runId)
if (isQuickTransfer && protocolId != null) {
navigate(`/quick-transfer/${protocolId}`)
} else if (isQuickTransfer) {
Expand Down
16 changes: 11 additions & 5 deletions app/src/pages/RunSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,17 @@ export function RunSummary(): JSX.Element {

const returnToQuickTransfer = (): void => {
// add this deletion if dismissal is successful and if its not needed
closeCurrentRun({
onSuccess: () => {
deleteRun(runId)
},
})
if (!isRunCurrent) {
deleteRun(runId)
console.log('not current, deleting')
} else {
console.log('current, closing')
closeCurrentRun({
onSuccess: () => {
deleteRun(runId)
},
})
}
navigate('/quick-transfer')
}

Expand Down

0 comments on commit 9b5ccf6

Please sign in to comment.