Skip to content

Commit

Permalink
update: back navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Jan 13, 2025
1 parent 5238b31 commit e215bc1
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export default function JobRunDetail() {
const isPending =
(stateLabel === 'Pending' || stateLabel === 'Running') &&
!currentNode?.stdout

const handleBackNavigation = () => {
if (typeof window !== 'undefined' && window.history.length <= 1) {
router.push('/jobs')
} else {
router.back()
}
}

React.useEffect(() => {
let timer: number
Expand All @@ -61,7 +69,7 @@ export default function JobRunDetail() {
{currentNode && (
<>
<div
onClick={() => router.back()}
onClick={handleBackNavigation}
className="-ml-1 flex cursor-pointer items-center transition-opacity hover:opacity-60"
>
<IconChevronLeft className="mr-1 h-6 w-6" />
Expand Down

0 comments on commit e215bc1

Please sign in to comment.