Skip to content

Commit

Permalink
fix(app): fix flickering "stand back" screen during gripper error rec…
Browse files Browse the repository at this point in the history
…overy
  • Loading branch information
mjhuff committed Nov 1, 2024
1 parent a6bd20a commit 602837b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('useHomeGripper', () => {
).toHaveBeenCalledTimes(1)
})

it('should reset hasHomedOnce when step changes to non-manual gripper step and back', async () => {
it('should only reset hasHomedOnce when step changes to non-manual gripper step', async () => {
const { rerender } = renderHook(
({ recoveryMap }) => {
useHomeGripper({
Expand Down Expand Up @@ -123,6 +123,10 @@ describe('useHomeGripper', () => {
await new Promise(resolve => setTimeout(resolve, 0))
})

expect(
mockRecoveryCommands.updatePositionEstimatorsAndHomeGripper
).toHaveBeenCalledTimes(1)

rerender({ recoveryMap: mockRecoveryMap })

await act(async () => {
Expand Down
6 changes: 3 additions & 3 deletions app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ export function useHomeGripper({
} else {
void handleMotionRouting(true)
.then(() => updatePositionEstimatorsAndHomeGripper())
.then(() => {
.finally(() => {
handleMotionRouting(false)
setHasHomedOnce(true)
})
.finally(() => handleMotionRouting(false))
}
}
} else {
if (!isManualGripperStep) {
if (!isManualGripperStep && hasHomedOnce) {
setHasHomedOnce(false)
}
}
Expand Down

0 comments on commit 602837b

Please sign in to comment.