From 4bca02a9476a8121544dc48081595f13091d2718 Mon Sep 17 00:00:00 2001 From: koji Date: Thu, 3 Oct 2024 15:17:57 -0400 Subject: [PATCH] fix(app): get back unboxingFlow path update function (#16411) * fix(app): get back unboxingFlow path update function --- app/src/pages/RobotDashboard/WelcomeModal.tsx | 10 ++++++++++ .../RobotDashboard/__tests__/WelcomeModal.test.tsx | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/pages/RobotDashboard/WelcomeModal.tsx b/app/src/pages/RobotDashboard/WelcomeModal.tsx index d8caef25f9a..67f5b3fdd09 100644 --- a/app/src/pages/RobotDashboard/WelcomeModal.tsx +++ b/app/src/pages/RobotDashboard/WelcomeModal.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import { useTranslation } from 'react-i18next' +import { useDispatch } from 'react-redux' import { COLORS, @@ -14,10 +15,12 @@ import { useCreateLiveCommandMutation } from '@opentrons/react-api-client' import { SmallButton } from '../../atoms/buttons' import { Modal } from '../../molecules/Modal' +import { updateConfigValue } from '../../redux/config' import welcomeModalImage from '../../assets/images/on-device-display/welcome_dashboard_modal.png' import type { SetStatusBarCreateCommand } from '@opentrons/shared-data' +import type { Dispatch } from '../../redux/types' interface WelcomeModalProps { setShowWelcomeModal: (showWelcomeModal: boolean) => void @@ -27,6 +30,7 @@ export function WelcomeModal({ setShowWelcomeModal, }: WelcomeModalProps): JSX.Element { const { t } = useTranslation(['device_details', 'shared']) + const dispatch = useDispatch() const { createLiveCommand } = useCreateLiveCommandMutation() const animationCommand: SetStatusBarCreateCommand = { @@ -44,6 +48,12 @@ export function WelcomeModal({ } const handleCloseModal = (): void => { + dispatch( + updateConfigValue( + 'onDeviceDisplaySettings.unfinishedUnboxingFlowRoute', + null + ) + ) setShowWelcomeModal(false) } diff --git a/app/src/pages/RobotDashboard/__tests__/WelcomeModal.test.tsx b/app/src/pages/RobotDashboard/__tests__/WelcomeModal.test.tsx index ec3fc2fc5ff..d01fed2b265 100644 --- a/app/src/pages/RobotDashboard/__tests__/WelcomeModal.test.tsx +++ b/app/src/pages/RobotDashboard/__tests__/WelcomeModal.test.tsx @@ -6,12 +6,13 @@ import { useCreateLiveCommandMutation } from '@opentrons/react-api-client' import { renderWithProviders } from '../../../__testing-utils__' import { i18n } from '../../../i18n' +import { updateConfigValue } from '../../../redux/config' import { WelcomeModal } from '../WelcomeModal' import type { SetStatusBarCreateCommand } from '@opentrons/shared-data' -vi.mock('../../../redux/config') vi.mock('@opentrons/react-api-client') +vi.mock('../../../redux/config') const mockFunc = vi.fn() const WELCOME_MODAL_IMAGE_NAME = 'welcome_dashboard_modal.png' @@ -61,6 +62,10 @@ describe('WelcomeModal', () => { it('should call a mock function when tapping next button', () => { render(props) fireEvent.click(screen.getByText('Next')) + expect(vi.mocked(updateConfigValue)).toHaveBeenCalledWith( + 'onDeviceDisplaySettings.unfinishedUnboxingFlowRoute', + null + ) expect(props.setShowWelcomeModal).toHaveBeenCalled() }) })