diff --git a/app/ui/containers/app.js b/app/ui/containers/app.js index 87d95c1574..0c26d5247e 100644 --- a/app/ui/containers/app.js +++ b/app/ui/containers/app.js @@ -937,11 +937,20 @@ function mapDispatchToProps (dispatch) { } async function _moveDoc (docToMove, parentId, targetId, targetOffset) { + // Nothing to do. We are in the same spot as we started if (docToMove._id === targetId) { - // Nothing to do. We are in the same spot as we started return; } + // Don't allow dragging things into itself or children. This will disconnect + // the node from the tree and cause the item to no longer show in the UI. + const descendents = await db.withDescendants(docToMove); + for (const doc of descendents) { + if (doc._id === parentId) { + return; + } + } + function __updateDoc (doc, patch) { models.getModel(docToMove.type).update(doc, patch); }