Skip to content

Commit c1f43d8

Browse files
committed
couldn’t add crew members if there are none yet (d’oh) #33
1 parent 83cb08a commit c1f43d8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

client/components/MissionForm.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ export default React.createClass({
8484
renderCrew(mission) {
8585
const crew = mission.crew;
8686

87-
if (_.isEmpty(crew)) return null;
88-
8987
const addMember = () => {
9088
crew.push({ status: 'none', volunteer: _.uniqueId() });
9189
this.setState({ mission });
@@ -104,7 +102,7 @@ export default React.createClass({
104102
};
105103

106104
return (
107-
<Table style={{ tableLayout: 'fixed' }}>
105+
<Table style={{ tableLayout: 'fixed', marginBottom: '1rem' }}>
108106
<thead>
109107
<tr>
110108
<th>Status</th><th>Group</th><th>Name (Einsätze)</th>
@@ -131,7 +129,10 @@ export default React.createClass({
131129
render() {
132130
const mission = this.state.mission;
133131
const getOption = v => ({ value: v.id, label: `${v.name.first || ''} ${v.name.last || ''}` });
134-
const currentVolunteers = mission.crew.map(a => getOption(this.context.volunteers[a.volunteer]));
132+
const currentVolunteers = mission.crew
133+
.map(a => this.context.volunteers[a.volunteer])
134+
.filter(Boolean) // remove unfinished selections
135+
.map(getOption);
135136

136137
return (
137138
<div>

0 commit comments

Comments
 (0)