Skip to content

Commit

Permalink
#1321 | Handle missing individualUUID prop on IndividualEncounterView
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed May 3, 2024
1 parent f5d579d commit ec23e12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class IndividualGeneralHistoryActions {

static onRender(state, action, context) {
const organisationConfigService = context.get(OrganisationConfigService);
if (organisationConfigService.isSaveDraftOn()) {
if (organisationConfigService.isSaveDraftOn() && !_.isNil(action.individualUUID)) {
const newState = IndividualGeneralHistoryActions.clone(state);
const individual = context.get(IndividualService).findByUUID(action.individualUUID);
newState.draftEncounters = context.get(DraftEncounterService).listUnScheduledDrafts(individual).map(draft => draft.constructEncounter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ class IndividualEncounterView extends AbstractComponent {

onAppHeaderBack() {
const onYesPress = () => {
this.dispatchAction(IGHActions.ON_RENDER, {individualUUID: this.props.individualUUID});
this.dispatchAction(IGHActions.ON_RENDER, {
individualUUID: this.props.individualUUID || this.props.encounter.individual.uuid
});
CHSNavigator.navigateToFirstPage(this, [IndividualEncounterView]);
}
AvniAlert(this.I18n.t('backPressTitle'), this.I18n.t('backPressMessage'), onYesPress, this.I18n);
Expand Down

0 comments on commit ec23e12

Please sign in to comment.