diff --git a/frontend/scenes/Document/Document.js b/frontend/scenes/Document/Document.js index 636dd7eb..e8882d91 100644 --- a/frontend/scenes/Document/Document.js +++ b/frontend/scenes/Document/Document.js @@ -75,7 +75,7 @@ type Props = { await this.document.save(); this.props.ui.disableEditMode(); - if (redirect) { + if (redirect && this.document) { this.props.history.push(this.document.url); } }; @@ -155,7 +155,7 @@ type Props = { {isEditing ? : Edit} diff --git a/frontend/scenes/Document/components/Menu.js b/frontend/scenes/Document/components/Menu.js index 6e044b59..76ac51a9 100644 --- a/frontend/scenes/Document/components/Menu.js +++ b/frontend/scenes/Document/components/Menu.js @@ -4,14 +4,12 @@ import invariant from 'invariant'; import get from 'lodash/get'; import { withRouter } from 'react-router-dom'; import { observer } from 'mobx-react'; -import type { Document as DocumentType } from 'types'; +import Document from 'models/Document'; import DropdownMenu, { MenuItem, MoreIcon } from 'components/DropdownMenu'; -import DocumentStore from '../DocumentStore'; type Props = { history: Object, - document: DocumentType, - store: DocumentStore, + document: Document, }; @observer class Menu extends Component { @@ -38,7 +36,7 @@ type Props = { } if (confirm(msg)) { - this.props.store.deleteDocument(); + this.props.document.delete(); } };