Skip to content

Commit

Permalink
fix(app): remove module card navigate on settled run query (#16131)
Browse files Browse the repository at this point in the history
removes a module card navigate route change on a settled run query with no data.

closes RQA-3099
  • Loading branch information
brenthagen authored Aug 26, 2024
1 parent 3be3a68 commit 132e86f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
8 changes: 2 additions & 6 deletions app/src/organisms/ModuleCard/__tests__/ModuleCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@ describe('ModuleCard', () => {
eatToast: mockEatToast,
})
vi.mocked(getRequestById).mockReturnValue(null)
when(useCurrentRunStatus)
.calledWith(expect.any(Object))
.thenReturn(RUN_STATUS_IDLE)
when(useCurrentRunStatus).calledWith().thenReturn(RUN_STATUS_IDLE)
when(useIsFlex).calledWith(props.robotName).thenReturn(true)
when(useIsEstopNotDisengaged).calledWith(props.robotName).thenReturn(false)
})
Expand Down Expand Up @@ -311,9 +309,7 @@ describe('ModuleCard', () => {
})

it('renders kebab icon and it is disabled when run is in progress', () => {
when(useCurrentRunStatus)
.calledWith(expect.any(Object))
.thenReturn(RUN_STATUS_RUNNING)
when(useCurrentRunStatus).calledWith().thenReturn(RUN_STATUS_RUNNING)
render({
...props,
module: mockMagneticModule,
Expand Down
11 changes: 2 additions & 9 deletions app/src/organisms/ModuleCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { useNavigate } from 'react-router-dom'

import {
ALIGN_START,
Expand Down Expand Up @@ -126,14 +125,8 @@ export const ModuleCard = (props: ModuleCardProps): JSX.Element | null => {
const [showCalModal, setShowCalModal] = React.useState(false)

const [targetProps, tooltipProps] = useHoverTooltip()
const navigate = useNavigate()
const runStatus = useCurrentRunStatus({
onSettled: data => {
if (data == null) {
navigate('/upload')
}
},
})

const runStatus = useCurrentRunStatus()
const isFlex = useIsFlex(robotName)
const requireModuleCalibration =
isFlex &&
Expand Down

0 comments on commit 132e86f

Please sign in to comment.