Skip to content

Commit 4bca02a

Browse files
authored
fix(app): get back unboxingFlow path update function (#16411)
* fix(app): get back unboxingFlow path update function
1 parent 5cde3b8 commit 4bca02a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

app/src/pages/RobotDashboard/WelcomeModal.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react'
22
import { useTranslation } from 'react-i18next'
3+
import { useDispatch } from 'react-redux'
34

45
import {
56
COLORS,
@@ -14,10 +15,12 @@ import { useCreateLiveCommandMutation } from '@opentrons/react-api-client'
1415

1516
import { SmallButton } from '../../atoms/buttons'
1617
import { Modal } from '../../molecules/Modal'
18+
import { updateConfigValue } from '../../redux/config'
1719

1820
import welcomeModalImage from '../../assets/images/on-device-display/welcome_dashboard_modal.png'
1921

2022
import type { SetStatusBarCreateCommand } from '@opentrons/shared-data'
23+
import type { Dispatch } from '../../redux/types'
2124

2225
interface WelcomeModalProps {
2326
setShowWelcomeModal: (showWelcomeModal: boolean) => void
@@ -27,6 +30,7 @@ export function WelcomeModal({
2730
setShowWelcomeModal,
2831
}: WelcomeModalProps): JSX.Element {
2932
const { t } = useTranslation(['device_details', 'shared'])
33+
const dispatch = useDispatch<Dispatch>()
3034

3135
const { createLiveCommand } = useCreateLiveCommandMutation()
3236
const animationCommand: SetStatusBarCreateCommand = {
@@ -44,6 +48,12 @@ export function WelcomeModal({
4448
}
4549

4650
const handleCloseModal = (): void => {
51+
dispatch(
52+
updateConfigValue(
53+
'onDeviceDisplaySettings.unfinishedUnboxingFlowRoute',
54+
null
55+
)
56+
)
4757
setShowWelcomeModal(false)
4858
}
4959

app/src/pages/RobotDashboard/__tests__/WelcomeModal.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import { useCreateLiveCommandMutation } from '@opentrons/react-api-client'
66

77
import { renderWithProviders } from '../../../__testing-utils__'
88
import { i18n } from '../../../i18n'
9+
import { updateConfigValue } from '../../../redux/config'
910
import { WelcomeModal } from '../WelcomeModal'
1011

1112
import type { SetStatusBarCreateCommand } from '@opentrons/shared-data'
1213

13-
vi.mock('../../../redux/config')
1414
vi.mock('@opentrons/react-api-client')
15+
vi.mock('../../../redux/config')
1516

1617
const mockFunc = vi.fn()
1718
const WELCOME_MODAL_IMAGE_NAME = 'welcome_dashboard_modal.png'
@@ -61,6 +62,10 @@ describe('WelcomeModal', () => {
6162
it('should call a mock function when tapping next button', () => {
6263
render(props)
6364
fireEvent.click(screen.getByText('Next'))
65+
expect(vi.mocked(updateConfigValue)).toHaveBeenCalledWith(
66+
'onDeviceDisplaySettings.unfinishedUnboxingFlowRoute',
67+
null
68+
)
6469
expect(props.setShowWelcomeModal).toHaveBeenCalled()
6570
})
6671
})

0 commit comments

Comments
 (0)