From 93366ef504210cc9aa746f7d10a4cc7d6188586d Mon Sep 17 00:00:00 2001 From: Alaa Yahia <6881345+alaa-yahia@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:53:06 +0200 Subject: [PATCH] fix: [DHIS2-17519] app crashing when opening new event from view event (#3781) * fix: app crashing when openeing new event from view event --- .../SingleEventRegistrationEntry.component.js | 1 - .../SingleEventRegistrationEntry.container.js | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.component.js b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.component.js index 90047ba753..24340325cb 100644 --- a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.component.js +++ b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.component.js @@ -22,4 +22,3 @@ export const SingleEventRegistrationEntryComponent = ({ showAddRelationship, eve ); }; - diff --git a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.container.js b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.container.js index 3c7d2d66d8..3d88627fb9 100644 --- a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.container.js +++ b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/SingleEventRegistrationEntry.container.js @@ -13,13 +13,14 @@ import { defaultDialogProps as dialogConfig } from '../../Dialogs/DiscardDialog. import { getOpenDataEntryActions } from './DataEntryWrapper/DataEntry'; import type { ContainerProps, StateProps, MapStateToProps } from './SingleEventRegistrationEntry.types'; import { useCategoryCombinations } from '../../DataEntryDhis2Helpers/AOC/useCategoryCombinations'; +import { itemId } from './DataEntryWrapper/DataEntry/helpers/constants'; const inEffect = (state: ReduxState) => dataEntryHasChanges(state, 'singleEvent-newEvent') || state.newEventPage.showAddRelationship; const makeMapStateToProps = (): MapStateToProps => { const eventAccessSelector = makeEventAccessSelector(); return (state: ReduxState, { id }: ContainerProps): StateProps => ({ - ready: state.dataEntries[id], + ready: state.dataEntries[id]?.itemId === itemId, showAddRelationship: !!state.newEventPage.showAddRelationship, eventAccess: eventAccessSelector(state), });