Fix bug when there is no group.
authorAlexandre Segura <mex.zktk@gmail.com>
Thu, 29 Jun 2017 12:06:48 +0200
changeset 106 fffefefed507
parent 105 0a1d6560acac
child 107 e6f85e26b08c
Fix bug when there is no group.
client/src/components/SessionForm.js
--- a/client/src/components/SessionForm.js	Thu Jun 29 12:05:09 2017 +0200
+++ b/client/src/components/SessionForm.js	Thu Jun 29 12:06:48 2017 +0200
@@ -126,7 +126,7 @@
             <FormControl
               name="group"
               componentClass="select"
-              value={ this.props.group.id }
+              value={ this.props.group ? this.props.group.id : '' }
               onChange={ this.onGroupChange }
               inputRef={ ref => { this.group = ref; } }>
               <option />
@@ -147,7 +147,7 @@
 function mapStateToProps(state, props) {
 
   let group;
-  if (props.session) {
+  if (props.session && props.session.group) {
     group = state.groups.find(group => props.session.group.get('id') === group.id)
   }