File tree Expand file tree Collapse file tree 1 file changed +26
-14
lines changed
Expand file tree Collapse file tree 1 file changed +26
-14
lines changed Original file line number Diff line number Diff line change @@ -493,13 +493,19 @@ export default handleActions({
493493 return patient ;
494494 } ,
495495 [ UPDATE_DIAGNOSIS ] : ( state , action ) => {
496- let activePatient = { ...state . activePatient } ;
497- activePatient . diagnosis = action . payload . diagnosis ;
498- let patient = {
499- ...state ,
500- activePatient : activePatient ,
501- } ;
502- return patient ;
496+ if ( state . activePatient ) {
497+ let activePatient = { ...state . activePatient } ;
498+ activePatient . diagnosis = action . payload . diagnosis ;
499+ let patient = {
500+ ...state ,
501+ activePatient : activePatient ,
502+ } ;
503+ return patient ;
504+ } else {
505+ return {
506+ ...state
507+ } ;
508+ }
503509 } ,
504510 [ REMOVE_ACTIVE_PATIENT ] : ( state , action ) => {
505511 let newState = {
@@ -702,13 +708,19 @@ export default handleActions({
702708 } ;
703709 } ,
704710 [ FOLLOW_UP_FETCH_LATEST ] : ( state , action ) => {
705- return {
706- ...state ,
707- activePatient : {
708- ...state . activePatient ,
709- activeFollowUp : state . activePatient . followUps [ 0 ]
710- }
711- } ;
711+ if ( state . activePatient && state . activePatient . followUps ) {
712+ return {
713+ ...state ,
714+ activePatient : {
715+ ...state . activePatient ,
716+ activeFollowUp : state . activePatient . followUps [ 0 ]
717+ }
718+ } ;
719+ } else {
720+ return {
721+ ...state
722+ } ;
723+ }
712724 } ,
713725 [ FOLLOW_UP_CREATE_NEW ] : ( state , action ) => {
714726 const now = new Date ( ) ;
You can’t perform that action at this time.
0 commit comments