Clear active collection if navigating out of it directly

Fixes #474
This commit is contained in:
Jori Lallo
2017-12-05 00:15:34 -08:00
parent 7af2ff20a8
commit 553095692c
3 changed files with 10 additions and 1 deletions

View File

@@ -49,6 +49,10 @@ class CollectionScene extends Component {
}
}
componentWillUnmount() {
this.props.ui.clearActiveCollection();
}
loadContent = async (id: string) => {
const { collections } = this.props;

View File

@@ -63,7 +63,7 @@ class DocumentScene extends Component {
@observable notFound = false;
@observable moveModalOpen: boolean = false;
componentWillMount() {
componentDidMount() {
this.loadDocument(this.props);
}

View File

@@ -35,6 +35,11 @@ class UiStore {
this.activeCollectionId = collection.id;
};
@action
clearActiveCollection = (): void => {
this.activeCollectionId = undefined;
};
@action
clearActiveDocument = (): void => {
this.activeDocumentId = undefined;