From 9a8aecca03289218437e907e82607699129124b8 Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Tue, 19 Nov 2024 11:50:20 +0300 Subject: [PATCH] (fix) Fix react hooks exhaustive deps warnings This PR fixes exhaustive deps warnings for React hooks flagged by the React hooks ESLint plugin. --- .eslintrc | 3 +- .../active-visits.resource.tsx | 2 +- .../end-appointment.modal.tsx | 4 +-- .../monthly-workload-view.component.tsx | 10 +++---- .../src/form/appointments-form.component.tsx | 4 +-- ...ent-appointments-action-menu.component.tsx | 6 ++-- .../src/summary/summary.resource.ts | 2 +- .../src/add-patient/add-patient.component.tsx | 6 ++-- .../src/lists-table/lists-table.component.tsx | 25 +++++++++-------- .../change-status-dialog.component.tsx | 2 +- .../src/hooks/useQueueEntries.ts | 10 +++---- .../patient-queue-header.component.tsx | 25 ++++++++++------- .../patient-scheduled-visits.component.tsx | 28 +++++++++---------- .../patient-search.workspace.tsx | 6 ++-- .../visit-form-queue-fields.component.tsx | 10 +++---- .../existing-visit-form.component.tsx | 18 ++++++++++-- .../visit-form/visit-form.component.tsx | 7 ++++- .../visit-type-selector.component.tsx | 6 ++-- .../transition-entry.component.tsx | 2 +- .../src/queue-table/cells/columns.resource.ts | 17 ++++++----- .../default-queue-table.component.tsx | 9 +++--- .../queue-entry-actions.modal.tsx | 8 +++++- .../src/queue-table/queue-table.component.tsx | 2 +- .../remove-queue-entry.component.tsx | 13 ++++++++- ...ransition-queue-entry-dialog.component.tsx | 17 +++++++++-- ...ueue-tables-for-all-statuses.component.tsx | 25 ++++++++--------- 26 files changed, 159 insertions(+), 108 deletions(-) diff --git a/.eslintrc b/.eslintrc index 992c5621d..c02ed2095 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,8 +11,8 @@ "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"], "rules": { - "import/no-duplicates": "error", "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", // Disabling these rules for now just to keep the diff small. We'll enable them one by one as we go. "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-types": "off", @@ -32,6 +32,7 @@ "fixStyle": "inline-type-imports" } ], + "import/no-duplicates": "error", "prefer-const": "off", "no-console": [ "error", diff --git a/packages/esm-active-visits-app/src/active-visits-widget/active-visits.resource.tsx b/packages/esm-active-visits-app/src/active-visits-widget/active-visits.resource.tsx index 765d8e872..53ffd00c1 100644 --- a/packages/esm-active-visits-app/src/active-visits-widget/active-visits.resource.tsx +++ b/packages/esm-active-visits-app/src/active-visits-widget/active-visits.resource.tsx @@ -76,7 +76,7 @@ export function useActiveVisits() { if (data && data?.[pageNumber - 1]?.data?.links?.some((link) => link.rel === 'next')) { setSize((currentSize) => currentSize + 1); } - }, [data, pageNumber]); + }, [data, pageNumber, setSize]); const mapVisitProperties = (visit: Visit): ActiveVisit => { // create base object diff --git a/packages/esm-appointments-app/src/appointments/common-components/end-appointment.modal.tsx b/packages/esm-appointments-app/src/appointments/common-components/end-appointment.modal.tsx index 0325a4ab4..25e84d049 100644 --- a/packages/esm-appointments-app/src/appointments/common-components/end-appointment.modal.tsx +++ b/packages/esm-appointments-app/src/appointments/common-components/end-appointment.modal.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; -import { showSnackbar, updateVisit, useVisit } from '@openmrs/esm-framework'; import { Button, ModalBody, ModalFooter, ModalHeader } from '@carbon/react'; +import { showSnackbar, updateVisit, useVisit } from '@openmrs/esm-framework'; import { changeAppointmentStatus } from '../../patient-appointments/patient-appointments.resource'; import { useMutateAppointments } from '../../form/appointments-form.resource'; @@ -68,7 +68,7 @@ const EndAppointmentModal: React.FC = ({ patientUuid, .finally(() => { closeModal(); }); - }, [activeVisit, mutate, mutateAppointments, closeModal, patientUuid, appointmentUuid]); + }, [activeVisit, appointmentUuid, closeModal, mutate, mutateAppointments, t]); return (
diff --git a/packages/esm-appointments-app/src/calendar/monthly/monthly-workload-view.component.tsx b/packages/esm-appointments-app/src/calendar/monthly/monthly-workload-view.component.tsx index 044b0da07..e16552e49 100644 --- a/packages/esm-appointments-app/src/calendar/monthly/monthly-workload-view.component.tsx +++ b/packages/esm-appointments-app/src/calendar/monthly/monthly-workload-view.component.tsx @@ -25,7 +25,7 @@ const MonthlyWorkloadView: React.FC = ({ dateTime, eve events?.find( (event) => dayjs(event.appointmentDate)?.format('YYYY-MM-DD') === dayjs(dateTime)?.format('YYYY-MM-DD'), ), - [events], + [dateTime, events], ); const visibleServices = useMemo(() => { @@ -34,7 +34,7 @@ const MonthlyWorkloadView: React.FC = ({ dateTime, eve return currentData.services.slice(0, layout === 'small-desktop' ? 2 : 4); } return []; - }, [currentData, showAllServices, layout, currentData]); + }, [currentData, showAllServices, layout]); const hasHiddenServices = useMemo(() => { if (currentData?.services) { @@ -42,7 +42,7 @@ const MonthlyWorkloadView: React.FC = ({ dateTime, eve return layout === 'small-desktop' ? currentData.services.length > 2 : currentData.services.length > 4; } return false; - }, [layout, currentData, currentData]); + }, [currentData?.services, layout, showAllServices]); const navigateToAppointmentsByDate = (serviceUuid: string) => { navigate({ to: `${spaHomePage}/appointments/${dayjs(dateTime).format('YYYY-MM-DD')}/${serviceUuid}` }); @@ -62,7 +62,7 @@ const MonthlyWorkloadView: React.FC = ({ dateTime, eve )}> {isSameMonth(dateTime, dayjs(selectedDate)) && (

-

+ {currentData?.services ? (
@@ -72,7 +72,7 @@ const MonthlyWorkloadView: React.FC = ({ dateTime, eve
)} {dateTime.format('D')} -
+ {currentData?.services && (
{visibleServices.map(({ serviceName, serviceUuid, count }, i) => ( diff --git a/packages/esm-appointments-app/src/form/appointments-form.component.tsx b/packages/esm-appointments-app/src/form/appointments-form.component.tsx index 611d0f7ed..97f20f5e7 100644 --- a/packages/esm-appointments-app/src/form/appointments-form.component.tsx +++ b/packages/esm-appointments-app/src/form/appointments-form.component.tsx @@ -251,7 +251,7 @@ const AppointmentsForm: React.FC }, }); - useEffect(() => setValue('formIsRecurringAppointment', isRecurringAppointment), [isRecurringAppointment]); + useEffect(() => setValue('formIsRecurringAppointment', isRecurringAppointment), [isRecurringAppointment, setValue]); // Retrive ref callback for appointmentDateTime (startDate & recurringPatternEndDate) const { @@ -277,7 +277,7 @@ const AppointmentsForm: React.FC return; } promptBeforeClosing(() => isDirty); - }, [isDirty, promptBeforeClosing, isSuccessful]); + }, [isDirty, promptBeforeClosing, isSuccessful, reset, closeWorkspace]); const handleWorkloadDateChange = (date: Date) => { const appointmentDate = getValues('appointmentDateTime'); diff --git a/packages/esm-appointments-app/src/patient-appointments/patient-appointments-action-menu.component.tsx b/packages/esm-appointments-app/src/patient-appointments/patient-appointments-action-menu.component.tsx index 62a3187f9..db8f997c0 100644 --- a/packages/esm-appointments-app/src/patient-appointments/patient-appointments-action-menu.component.tsx +++ b/packages/esm-appointments-app/src/patient-appointments/patient-appointments-action-menu.component.tsx @@ -1,13 +1,11 @@ import React, { useCallback, useContext } from 'react'; import { useTranslation } from 'react-i18next'; - import { Layer, OverflowMenu, OverflowMenuItem } from '@carbon/react'; import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; import { launchWorkspace, showModal, useLayoutType } from '@openmrs/esm-framework'; import type { Appointment } from '../types'; -import styles from './patient-appointments-action-menu.scss'; - import PatientAppointmentContext, { PatientAppointmentContextTypes } from '../hooks/patientAppointmentContext'; +import styles from './patient-appointments-action-menu.scss'; interface appointmentsActionMenuProps { appointment: Appointment; @@ -32,7 +30,7 @@ export const PatientAppointmentsActionMenu = ({ appointment, patientUuid }: appo appointment, }); } - }, [appointment, t]); + }, [appointment, patientAppointmentContext, t]); const launchCancelAppointmentDialog = () => { const dispose = showModal('patient-appointment-cancel-confirmation-dialog', { diff --git a/packages/esm-bed-management-app/src/summary/summary.resource.ts b/packages/esm-bed-management-app/src/summary/summary.resource.ts index 48e8e1e97..240493d88 100644 --- a/packages/esm-bed-management-app/src/summary/summary.resource.ts +++ b/packages/esm-bed-management-app/src/summary/summary.resource.ts @@ -142,7 +142,7 @@ export function useBedsGroupedByLocation() { isValidatingBedsGroupedByLocation: isValidating, mutateBedsGroupedByLocation: mutate, }), - [result, error, isLoading, isValidating, mutate], + [error, isLoading, isLoadingAdmissionLocations, isValidating, mutate, result], ); return results; diff --git a/packages/esm-patient-list-management-app/src/add-patient/add-patient.component.tsx b/packages/esm-patient-list-management-app/src/add-patient/add-patient.component.tsx index 6c6b5b345..e3ec1d27d 100644 --- a/packages/esm-patient-list-management-app/src/add-patient/add-patient.component.tsx +++ b/packages/esm-patient-list-management-app/src/add-patient/add-patient.component.tsx @@ -39,7 +39,7 @@ const AddPatient: React.FC = ({ closeModal, patientUuid }) => { const key = `${restBaseUrl}/cohortm/cohortmember?patient=${patientUuid}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`; return mutate((k) => typeof k === 'string' && k === key); - }, []); + }, [patientUuid]); const handleSubmit = useCallback(() => { Promise.all( @@ -67,7 +67,7 @@ const AddPatient: React.FC = ({ closeModal, patientUuid }) => { }); }), ).finally(closeModal); - }, [data, selected, closeModal, t, patientUuid]); + }, [selected, closeModal, data, mutateCohortMembers, t]); const searchResults = useMemo(() => { if (!data) { @@ -88,7 +88,7 @@ const AddPatient: React.FC = ({ closeModal, patientUuid }) => { if (currentPage !== 1) { goTo(1); } - }, [searchValue]); + }, [currentPage, goTo, searchValue]); return (
diff --git a/packages/esm-patient-list-management-app/src/lists-table/lists-table.component.tsx b/packages/esm-patient-list-management-app/src/lists-table/lists-table.component.tsx index ad657e335..b8554bf01 100755 --- a/packages/esm-patient-list-management-app/src/lists-table/lists-table.component.tsx +++ b/packages/esm-patient-list-management-app/src/lists-table/lists-table.component.tsx @@ -269,19 +269,22 @@ function useStarredLists() { setStarredLists(starredPatientLists.split(',')); }, [currentUser?.userProperties?.starredPatientLists, setStarredLists]); - const updateUserProperties = (newStarredLists: Array) => { - const starredPatientLists = newStarredLists.join(','); - const userProperties = { ...(currentUser?.userProperties ?? {}), starredPatientLists }; + const updateUserProperties = useCallback( + (newStarredLists: Array) => { + const starredPatientLists = newStarredLists.join(','); + const userProperties = { ...(currentUser?.userProperties ?? {}), starredPatientLists }; - starPatientList(currentUser?.uuid, userProperties).catch(() => { - setInitialStarredLists(); - showSnackbar({ - subtitle: t('starringPatientListFailed', 'Marking patient lists starred / unstarred failed'), - kind: 'error', - title: 'Failed to update patient lists', + starPatientList(currentUser?.uuid, userProperties).catch(() => { + setInitialStarredLists(); + showSnackbar({ + subtitle: t('starringPatientListFailed', 'Marking patient lists starred / unstarred failed'), + kind: 'error', + title: 'Failed to update patient lists', + }); }); - }); - }; + }, + [currentUser?.userProperties, currentUser?.uuid, setInitialStarredLists, t], + ); /** * Handles toggling the starred list diff --git a/packages/esm-service-queues-app/src/active-visits/change-status-dialog.component.tsx b/packages/esm-service-queues-app/src/active-visits/change-status-dialog.component.tsx index e9d9bad2a..a15b47c72 100644 --- a/packages/esm-service-queues-app/src/active-visits/change-status-dialog.component.tsx +++ b/packages/esm-service-queues-app/src/active-visits/change-status-dialog.component.tsx @@ -46,7 +46,7 @@ const ChangeStatus: React.FC = ({ queueEntry, closeModa service: z.string({ required_error: t('serviceIsRequired', 'Service is required') }), status: z.string({ required_error: t('statusIsRequired', 'Status is required') }), }), - [], + [t], ); type ChangeStatusForm = z.infer; diff --git a/packages/esm-service-queues-app/src/hooks/useQueueEntries.ts b/packages/esm-service-queues-app/src/hooks/useQueueEntries.ts index 688e92ee9..d8704b6ac 100644 --- a/packages/esm-service-queues-app/src/hooks/useQueueEntries.ts +++ b/packages/esm-service-queues-app/src/hooks/useQueueEntries.ts @@ -1,9 +1,9 @@ -import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework'; -import { type QueueEntry, type QueueEntrySearchCriteria } from '../types'; -import useSWR from 'swr'; import { useCallback, useEffect, useMemo, useState } from 'react'; -import { useSWRConfig } from 'swr/_internal'; import isEqual from 'lodash-es/isEqual'; +import useSWR from 'swr'; +import { useSWRConfig } from 'swr/_internal'; +import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework'; +import { type QueueEntry, type QueueEntrySearchCriteria } from '../types'; type QueueEntryResponse = FetchResponse<{ results: Array; @@ -111,7 +111,7 @@ export function useQueueEntries(searchCriteria?: QueueEntrySearchCriteria, rep: } refetchAllData(rep, searchCriteria); } - }, [searchCriteria, currentSearchCriteria, setCurrentSearchCriteria, currentRep, rep]); + }, [currentRep, currentSearchCriteria, refetchAllData, rep, searchCriteria, setCurrentSearchCriteria]); const { data: pageData, isValidating, error: pageError } = useSWR(pageUrl, openmrsFetch); diff --git a/packages/esm-service-queues-app/src/patient-queue-header/patient-queue-header.component.tsx b/packages/esm-service-queues-app/src/patient-queue-header/patient-queue-header.component.tsx index 4b47c05d0..8b2f98b43 100644 --- a/packages/esm-service-queues-app/src/patient-queue-header/patient-queue-header.component.tsx +++ b/packages/esm-service-queues-app/src/patient-queue-header/patient-queue-header.component.tsx @@ -27,16 +27,19 @@ const PatientQueueHeader: React.FC = ({ title, showLoca const currentQueueLocationName = useSelectedQueueLocationName(); const currentQueueLocationUuid = useSelectedQueueLocationUuid(); - const handleQueueLocationChange = useCallback(({ selectedItem }) => { - if (selectedItem.id === 'all') { - updateSelectedQueueLocationUuid(null); - updateSelectedQueueLocationName(null); - } else { - updateSelectedQueueLocationUuid(selectedItem.id); - updateSelectedQueueLocationName(selectedItem.name); - updateSelectedService(null, t('all', 'All')); - } - }, []); + const handleQueueLocationChange = useCallback( + ({ selectedItem }) => { + if (selectedItem.id === 'all') { + updateSelectedQueueLocationUuid(null); + updateSelectedQueueLocationName(null); + } else { + updateSelectedQueueLocationUuid(selectedItem.id); + updateSelectedQueueLocationName(selectedItem.name); + updateSelectedService(null, t('all', 'All')); + } + }, + [t], + ); useEffect(() => { if (!isLoading && !error && !currentQueueLocationUuid) { @@ -62,6 +65,8 @@ const PatientQueueHeader: React.FC = ({ title, showLoca isLoading, error, userSession?.sessionLocation?.uuid, + handleQueueLocationChange, + userSession?.sessionLocation?.display, ]); return ( diff --git a/packages/esm-service-queues-app/src/patient-search/patient-scheduled-visits.component.tsx b/packages/esm-service-queues-app/src/patient-search/patient-scheduled-visits.component.tsx index 87423f481..37fcdb36b 100644 --- a/packages/esm-service-queues-app/src/patient-search/patient-scheduled-visits.component.tsx +++ b/packages/esm-service-queues-app/src/patient-search/patient-scheduled-visits.component.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import dayjs from 'dayjs'; import head from 'lodash-es/head'; import { useTranslation } from 'react-i18next'; @@ -59,7 +59,7 @@ const ScheduledVisitsForVisitType: React.FC<{ const { mutateQueueEntries } = useMutateQueueEntries(); const [isSubmitting, setIsSubmitting] = useState(false); const timeFormat = new Date().getHours() >= 12 ? 'PM' : 'AM'; - const visitDate = new Date(); + const visitDate = useMemo(() => new Date(), []); const visitTime = dayjs(new Date()).format('hh:mm'); const [appointment, setAppointment] = useState(); const [patientId, setPatientId] = useState(''); @@ -159,23 +159,21 @@ const ScheduledVisitsForVisitType: React.FC<{ } }, [ - visitTime, - timeFormat, allVisitTypes, - patientId, - visitDate, - userLocation, - queues, - config.concepts.defaultStatusConceptUuid, - config.concepts.defaultPriorityConceptUuid, - currentVisit, - t, - priorities, appointment, - selectedQueueLocation, - visitQueueNumberAttributeUuid, closeWorkspace, + currentVisit, + defaultStatus, mutateQueueEntries, + patientId, + selectedQueueLocation, + service, + t, + timeFormat, + userLocation, + visitDate, + visitQueueNumberAttributeUuid, + visitTime, ], ); diff --git a/packages/esm-service-queues-app/src/patient-search/patient-search.workspace.tsx b/packages/esm-service-queues-app/src/patient-search/patient-search.workspace.tsx index 16de6af6d..f272c9f1a 100644 --- a/packages/esm-service-queues-app/src/patient-search/patient-search.workspace.tsx +++ b/packages/esm-service-queues-app/src/patient-search/patient-search.workspace.tsx @@ -1,9 +1,8 @@ import React, { useEffect, useState } from 'react'; -import { Button, DataTableSkeleton } from '@carbon/react'; import isNil from 'lodash-es/isNil'; import { useTranslation } from 'react-i18next'; +import { Button, DataTableSkeleton } from '@carbon/react'; import { - type DefaultWorkspaceProps, ArrowLeftIcon, ErrorState, getPatientName, @@ -11,6 +10,7 @@ import { PatientBannerPatientInfo, PatientBannerToggleContactDetailsButton, PatientPhoto, + type DefaultWorkspaceProps, usePatient, useVisit, } from '@openmrs/esm-framework'; @@ -69,7 +69,7 @@ const PatientSearch: React.FC = ({ if (searchType === SearchTypes.SCHEDULED_VISITS && appointments && !hasAppointments) { setSearchType(SearchTypes.VISIT_FORM); } - }, [hasAppointments, appointments]); + }, [appointments, hasAppointments, searchType]); useEffect(() => { if (searchType === SearchTypes.SEARCH_RESULTS) { diff --git a/packages/esm-service-queues-app/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx b/packages/esm-service-queues-app/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx index 192277d79..c99aadc2c 100644 --- a/packages/esm-service-queues-app/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx +++ b/packages/esm-service-queues-app/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx @@ -12,9 +12,9 @@ import { TextInput, } from '@carbon/react'; import { useConfig, ResponsiveWrapper, useSession } from '@openmrs/esm-framework'; +import { type ConfigObject } from '../../config-schema'; import { useQueues } from '../../hooks/useQueues'; import { useQueueLocations } from '../hooks/useQueueLocations'; -import { type ConfigObject } from '../../config-schema'; import { AddPatientToQueueContext } from '../patient-search.workspace'; import styles from './visit-form-queue-fields.scss'; @@ -47,19 +47,19 @@ const VisitFormQueueFields: React.FC = (props) => { if (priority === config.concepts.emergencyPriorityConceptUuid) { setSortWeight(1); } - }, [priority]); + }, [config.concepts.emergencyPriorityConceptUuid, priority]); useEffect(() => { if (currentServiceQueueUuid) { setSelectedService(currentServiceQueueUuid); } - }, [queues]); + }, [currentServiceQueueUuid, queues]); useEffect(() => { if (queueLocations.map((l) => l.id).includes(sessionLocation.uuid)) { setSelectedQueueLocation(sessionLocation.uuid); } - }, [queueLocations]); + }, [queueLocations, sessionLocation.uuid]); useEffect(() => { setFormFields({ @@ -69,7 +69,7 @@ const VisitFormQueueFields: React.FC = (props) => { priority, sortWeight, }); - }, [selectedQueueLocation, selectedService, defaultStatus, priority, sortWeight]); + }, [selectedQueueLocation, selectedService, defaultStatus, priority, sortWeight, setFormFields]); return (
diff --git a/packages/esm-service-queues-app/src/patient-search/visit-form/existing-visit-form.component.tsx b/packages/esm-service-queues-app/src/patient-search/visit-form/existing-visit-form.component.tsx index a2a342891..3264e6e65 100644 --- a/packages/esm-service-queues-app/src/patient-search/visit-form/existing-visit-form.component.tsx +++ b/packages/esm-service-queues-app/src/patient-search/visit-form/existing-visit-form.component.tsx @@ -1,4 +1,5 @@ import React, { useCallback, useState } from 'react'; +import classNames from 'classnames'; import { Button, ButtonSet, Form, Row } from '@carbon/react'; import { useTranslation } from 'react-i18next'; import { @@ -11,9 +12,8 @@ import { } from '@openmrs/esm-framework'; import { postQueueEntry } from '../../active-visits/active-visits-table.resource'; import { useMutateQueueEntries } from '../../hooks/useQueueEntries'; -import styles from './visit-form.scss'; -import classNames from 'classnames'; import VisitFormQueueFields from '../visit-form-queue-fields/visit-form-queue-fields.component'; +import styles from './visit-form.scss'; interface ExistingVisitFormProps { closeWorkspace: () => void; @@ -80,7 +80,19 @@ const ExistingVisitForm: React.FC = ({ visit, closeWorks }, ); }, - [closeWorkspace, mutateQueueEntries, visit, t, visitQueueNumberAttributeUuid], + [ + closeWorkspace, + mutateQueueEntries, + priority, + queueLocation, + service, + sortWeight, + status, + t, + visit.patient.uuid, + visit.uuid, + visitQueueNumberAttributeUuid, + ], ); return visit ? ( diff --git a/packages/esm-service-queues-app/src/patient-search/visit-form/visit-form.component.tsx b/packages/esm-service-queues-app/src/patient-search/visit-form/visit-form.component.tsx index 81f72fe85..2c07a1977 100644 --- a/packages/esm-service-queues-app/src/patient-search/visit-form/visit-form.component.tsx +++ b/packages/esm-service-queues-app/src/patient-search/visit-form/visit-form.component.tsx @@ -86,7 +86,7 @@ const VisitForm: React.FC = ({ patientUuid, closeWorkspace }) => } else if (!loadingDefaultFacility && defaultFacility) { setSelectedLocation(defaultFacility?.uuid); } - }, [locations, sessionUser, loadingDefaultFacility]); + }, [defaultFacility, loadingDefaultFacility, locations, sessionUser]); const handleSubmit = useCallback( (event) => { @@ -164,7 +164,12 @@ const VisitForm: React.FC = ({ patientUuid, closeWorkspace }) => closeWorkspace, mutateQueueEntries, patientUuid, + priority, + queueLocation, selectedLocation, + service, + sortWeight, + status, t, timeFormat, visitDate, diff --git a/packages/esm-service-queues-app/src/patient-search/visit-form/visit-type-selector.component.tsx b/packages/esm-service-queues-app/src/patient-search/visit-form/visit-type-selector.component.tsx index 9e7ef26cf..9551a1064 100644 --- a/packages/esm-service-queues-app/src/patient-search/visit-form/visit-type-selector.component.tsx +++ b/packages/esm-service-queues-app/src/patient-search/visit-form/visit-type-selector.component.tsx @@ -12,10 +12,10 @@ import { Tile, } from '@carbon/react'; import { ResponsiveWrapper, useDebounce, useLayoutType, useVisitTypes, type VisitType } from '@openmrs/esm-framework'; +import { type PatientProgram } from '../../types'; +import { useRecommendedVisitTypes } from '../hooks/useRecommendedVisitTypes'; import EmptyDataIllustration from '../empty-data-illustration.component'; import styles from './visit-type-selector.scss'; -import { useRecommendedVisitTypes } from '../hooks/useRecommendedVisitTypes'; -import { type PatientProgram } from '../../types'; export interface VisitTypeSelectorProps { onChange: (event) => void; @@ -104,7 +104,7 @@ const VisitTypeSelectorPresentation: React.FC = ({ queueEntry }) => { closeModal: () => dispose(), queueEntry, }); - }, [queueEntry]); + }, [queueEntry, t]); return (