Commit 8cf95e3a40219e57e5da99d40bfedf5227b0bf81

Authored by themeteorchef
1 parent cc7aef11fd
Exists in master

fix documentation deletion throwing React errors

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
imports/ui/pages/ViewDocument.js
... ... @@ -24,7 +24,7 @@ const handleRemove = (_id) => {
24 24 const ViewDocument = ({ doc }) => (
25 25 <div className="ViewDocument">
26 26 <div className="page-header clearfix">
27   - <h4 className="pull-left">{ doc.title }</h4>
  27 + <h4 className="pull-left">{ doc && doc.title }</h4>
28 28 <ButtonToolbar className="pull-right">
29 29 <ButtonGroup bsSize="small">
30 30 <Button onClick={ () => handleEdit(doc._id) }>Edit</Button>
... ... @@ -32,12 +32,12 @@ const ViewDocument = ({ doc }) =&gt; (
32 32 </ButtonGroup>
33 33 </ButtonToolbar>
34 34 </div>
35   - { doc.body }
  35 + { doc && doc.body }
36 36 </div>
37 37 );
38 38  
39 39 ViewDocument.propTypes = {
40   - doc: React.PropTypes.object.isRequired,
  40 + doc: React.PropTypes.object,
41 41 };
42 42  
43 43 export default ViewDocument;
... ...