diff --git a/app/scenes/Collection/Collection.js b/app/scenes/Collection/Collection.js index 9375ac37a..74bc1b4a5 100644 --- a/app/scenes/Collection/Collection.js +++ b/app/scenes/Collection/Collection.js @@ -49,6 +49,10 @@ class CollectionScene extends Component { } } + componentWillUnmount() { + this.props.ui.clearActiveCollection(); + } + loadContent = async (id: string) => { const { collections } = this.props; diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index 084d96f68..da430b8ef 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -63,7 +63,7 @@ class DocumentScene extends Component { @observable notFound = false; @observable moveModalOpen: boolean = false; - componentWillMount() { + componentDidMount() { this.loadDocument(this.props); } diff --git a/app/stores/UiStore.js b/app/stores/UiStore.js index 3fc05269d..09e42feb9 100644 --- a/app/stores/UiStore.js +++ b/app/stores/UiStore.js @@ -35,6 +35,11 @@ class UiStore { this.activeCollectionId = collection.id; }; + @action + clearActiveCollection = (): void => { + this.activeCollectionId = undefined; + }; + @action clearActiveDocument = (): void => { this.activeDocumentId = undefined;