Fixed lag in toggling documents
This commit is contained in:
@@ -93,7 +93,7 @@ type Props = {
|
|||||||
});
|
});
|
||||||
this.newDocument = newDocument;
|
this.newDocument = newDocument;
|
||||||
} else {
|
} else {
|
||||||
let document = this.document;
|
let document = this.getDocument(props.match.params.documentSlug);
|
||||||
if (document) {
|
if (document) {
|
||||||
this.props.ui.setActiveDocument(document);
|
this.props.ui.setActiveDocument(document);
|
||||||
}
|
}
|
||||||
@@ -124,13 +124,17 @@ type Props = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get document() {
|
getDocument(documentSlug: ?string) {
|
||||||
if (this.newDocument) return this.newDocument;
|
if (this.newDocument) return this.newDocument;
|
||||||
return this.props.documents.getByUrl(
|
return this.props.documents.getByUrl(
|
||||||
`/doc/${this.props.match.params.documentSlug}`
|
`/doc/${documentSlug || this.props.match.params.documentSlug}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get document() {
|
||||||
|
return this.getDocument();
|
||||||
|
}
|
||||||
|
|
||||||
onClickEdit = () => {
|
onClickEdit = () => {
|
||||||
if (!this.document) return;
|
if (!this.document) return;
|
||||||
const url = `${this.document.url}/edit`;
|
const url = `${this.document.url}/edit`;
|
||||||
|
|||||||
Reference in New Issue
Block a user