diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripper.test.ts similarity index 94% rename from app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts rename to app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripper.test.ts index 32f5d939eb8..aefd00e5db2 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripper.test.ts @@ -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({ @@ -123,6 +123,10 @@ describe('useHomeGripper', () => { await new Promise(resolve => setTimeout(resolve, 0)) }) + expect( + mockRecoveryCommands.updatePositionEstimatorsAndHomeGripper + ).toHaveBeenCalledTimes(1) + rerender({ recoveryMap: mockRecoveryMap }) await act(async () => { diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripper.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripper.ts index b165e59ebd4..38299761cfd 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripper.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripper.ts @@ -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) } }