Added await for deletion to prevent race condition
This commit is contained in:
@ -28,7 +28,7 @@ type Props = {
|
|||||||
this.props.history.push(`${this.props.document.url}/new`);
|
this.props.history.push(`${this.props.document.url}/new`);
|
||||||
};
|
};
|
||||||
|
|
||||||
onDelete = () => {
|
onDelete = async () => {
|
||||||
let msg;
|
let msg;
|
||||||
if (get(this.props, 'document.collection.type') === 'atlas') {
|
if (get(this.props, 'document.collection.type') === 'atlas') {
|
||||||
msg =
|
msg =
|
||||||
@ -38,7 +38,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (confirm(msg)) {
|
if (confirm(msg)) {
|
||||||
this.props.document.delete();
|
await this.props.document.delete();
|
||||||
this.props.history.push(this.props.document.collection.url);
|
this.props.history.push(this.props.document.collection.url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user