Skip to content

Commit

Permalink
Fixed the incorrect assignment to isOffline (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasharma05 authored Jun 29, 2023
1 parent 3e52e59 commit 541a7fb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/esm-patient-registration-app/src/root.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import useSWRImmutable from 'swr/immutable';
import styles from './root.scss';

export default function Root() {
const isOffline = useConnectivity();
const isOnline = useConnectivity();
const currentSession = useSession();
const { data: addressTemplate } = useSWRImmutable('patientRegistrationAddressTemplate', fetchAddressTemplate);
const { data: relationshipTypes } = useSWRImmutable(
Expand All @@ -26,8 +26,8 @@ export default function Root() {
fetchPatientIdentifierTypesWithSources,
);
const savePatientForm = useMemo(
() => (isOffline ? FormManager.savePatientFormOffline : FormManager.savePatientFormOnline),
[isOffline],
() => (isOnline ? FormManager.savePatientFormOnline : FormManager.savePatientFormOffline),
[isOnline],
);

return (
Expand All @@ -47,11 +47,11 @@ export default function Root() {
<Routes>
<Route
path="patient-registration"
element={<PatientRegistration savePatientForm={savePatientForm} isOffline={isOffline} />}
element={<PatientRegistration savePatientForm={savePatientForm} isOffline={!isOnline} />}
/>
<Route
path="patient/:patientUuid/edit"
element={<PatientRegistration savePatientForm={savePatientForm} isOffline={isOffline} />}
element={<PatientRegistration savePatientForm={savePatientForm} isOffline={!isOnline} />}
/>
</Routes>
</BrowserRouter>
Expand Down

0 comments on commit 541a7fb

Please sign in to comment.