Skip to content

Commit 0fbf727

Browse files
author
Matthew Vita
committed
add contact improvements
1 parent 7fc887f commit 0fbf727

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

samples/react-redux-patient-demographics-example/src/routes/Patient/Demographics/Contact/ContactComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class Contact extends Component {
115115
</tr>
116116
<tr>
117117
<td><strong>Email:</strong> {this.props.contact.email}</td>
118-
<td></td>
119118
</tr>
120119
</tbody>
121120
</table>

samples/react-redux-patient-demographics-example/src/routes/Patient/PatientModule.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ export default function patientReducer (state = initialState, action) {
160160
result = copy
161161
break
162162
case 'START_ADDING_CONTACT':
163-
const newContactId = _.last(copy[action.payload[0]].contacts).id + 1;
163+
const lastContact = _.last(copy[action.payload[0]].contacts)
164+
let newContactId = 0
165+
if (lastContact != null && lastContact.hasOwnProperty('id')) {
166+
newContactId = lastContact.id + 1
167+
}
164168
copy[action.payload[0]].contacts.push({ isNewContact: true, id: newContactId })
165169
result = copy
166170
break

0 commit comments

Comments
 (0)