Issue Bug Under Review

#111503Workspaces: publishing keeps the live MM rows of an inline field with an MM table

Benjamin Kott 11/18/26, 22:29 updated 11/19/26, 08:09

Description

Problem

When a workspace version of a record with an inline field on an MM table (type => inline with MM) is published, the live record takes the number of children from the version, but its rows in the MM table stay as they were. The MM rows of the version are left behind, and the reference index of the live record is not updated.

So every change of the children made in a workspace is lost on publish:

  • Children removed in the workspace stay related to the live record, while its field counts fewer of them, down to 0.
  • Children added in the workspace are not related to the live record, while its field counts them.
  • A new order of the children is lost.

The same happens on the opposite side of a bidirectional relation (MM_opposite_field): publishing a version of the child record leaves its MM rows behind as well.

Group, select and category fields with MM replace the live MM rows on publish.

  1. describes how such a version came into existence without its children; this report is about publishing any version of such a record.

Steps to reproduce

  1. Configure a field with type inline, a foreign_table and an MM table, and give a live record two children in it
  2. In a workspace, edit the record: remove a child, add another one or change their order, then save
  3. Publish the record
  4. Compare the field value of the live record with its rows in the MM table

Cause

DataHandler::versionPublishManyToManyRelations() only handles fields for which isReferenceField() is true, i.e. group, select and category. Inline fields with an MM table are skipped, so on publish their live MM rows are neither deleted nor replaced by the rows of the version, while the field value is taken over from the version.

Handling them like group fields alone is not enough: the MM rows of a version only carry the sorting of the version’s own side, so the related records would lose the order they have on the opposite side (sorting_foreign, or sorting for the opposite field).

Reviews 1

History 02