- Fix PropTypes warning on EditDocument.js when failing to pass a doc prop.
- Improve 404 handling on EditDocument.js and ViewDocument.js when no doc prop is passed.
This commit is contained in:
parent
7e3116677a
commit
11ba0bafaa
2 changed files with 7 additions and 3 deletions
|
|
@ -13,8 +13,12 @@ const EditDocument = ({ doc, history }) => (doc ? (
|
|||
</div>
|
||||
) : <NotFound />);
|
||||
|
||||
EditDocument.defaultProps = {
|
||||
doc: null,
|
||||
};
|
||||
|
||||
EditDocument.propTypes = {
|
||||
doc: PropTypes.object.isRequired,
|
||||
doc: PropTypes.object,
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const ViewDocument = ({ loading, doc, match, history }) => (
|
|||
|
||||
ViewDocument.propTypes = {
|
||||
loading: PropTypes.bool.isRequired,
|
||||
doc: PropTypes.object.isRequired,
|
||||
doc: PropTypes.object,
|
||||
match: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
|
@ -55,6 +55,6 @@ export default createContainer(({ match }) => {
|
|||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
doc: Documents.findOne(documentId) || {},
|
||||
doc: Documents.findOne(documentId),
|
||||
};
|
||||
}, ViewDocument);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue