Removing a collection query or deleting a collection blocks publishing or forces deleting its children

Problem

Two related flows make it hard to change a collection without losing its child documents.

1. Converting a collection to a regular document fails to publish

Steps to reproduce:

    Open a collection document that has many children (for example, a site Home).

    Convert it from a Document Collection to a regular document, which removes its self-query block.

    Publish.

Result: the publish stops with "Unable to review child deletions" before anything reaches the network.

Why it happens:

    When a published self-query is removed, the publish flow assumes every direct child that the new content no longer links to should be deleted, together with all of its descendants.

    To build the deletion list, it loads every descendant. Deleted documents are skipped, but anything else that isn't a document throws an error.

    A document that was moved leaves a redirect at its old path. The scan hits that redirect and fails, so any collection with a moved document anywhere underneath it can never publish this change.

Even with the redirect handled, the flow then offers to delete every unlinked child. For a site Home, that can mean thousands of documents. The only way out is "Back to editing", so there is no way to publish the conversion and keep the children.

This also differs from the rule described in Document reference reconciliation, which says removing or narrowing a query should never enqueue child deletion.

2. Deleting a collection always deletes its children

Deleting a document deletes it and its whole subtree in one step. There is no way to keep the children, for example to delete a "Writing" collection but keep its posts somewhere else.

Proposed solution

Redirects no longer block publishing

    The deletion review skips redirects the same way it already skips deleted documents. Redirects are not followed and are not added to the deletion list.

    If a document that was approved for deletion turns into a redirect before the deletion runs, it is still rejected, so a deletion never goes through a redirect.

"Publish without deleting"


    The child-deletion dialog has a new Publish without deleting button next to Publish and delete N documents.

    It is also shown when the review fails, so a failed review no longer blocks a publish that deletes nothing.

    Choosing it publishes the parent with no deletions approved. The children stay where they are.

    The dialog footer no longer overflows: "Back to editing" is now a close button (X) in the top-right corner, and Escape also cancels.

"Move children…" when deleting a document



    When a document has children, the delete dialog offers Move children… on desktop and web. On web it is only shown if you are allowed to delete the document.

    You pick a destination (by default, the parent's own parent). The dialog lists where each document will land.

    Moving is blocked if a destination path is taken, two children would land on the same path, the destination is inside the document being deleted, or the destination is outside the space, private or not writable.

    Every destination is checked before anything is published. The children then move one at a time with their subtrees, and the parent is deleted only after all of them have moved.

    Each move leaves a redirect at the old path, so old links keep working.

    If a move fails partway, the parent is not deleted and the error says how many children were moved.

Open questions

    Should removing a self-query offer to delete children at all, given the reconciliation rule above? Or should the deletion review only run when a direct link to a child is removed?

    Should "Move children…" ship in the same PR as the publish fix, or separately?

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0
Linked document · Outgoing linkLinked documentRemoving a collection query or deleting a collection blocks publishing or forces deleting its childrenRemoving a collection que…
Citations 0Children & links 1

Loading child documents…

Connections show where other documents or comments link to this document.

Related documents

Loading connections…