Skip to content

[5.x]: Craft 5 upgrade for matrix changes sort order of migrated matrix blocks #16314

@MoritzLost

Description

@MoritzLost

What happened?

Description

During the Craft 5 upgrade, all matrix block types in all matrix fields are converted to entries. The matrix block types setting is replaced by an entry type selection. We found that during this update, the existing order of the matrix blocks is not maintained. After the update, the entry types selected in the matrix field are in a (seemingly) random order, instead of the order the matrix blocks had. This is bad for the author experience, as you usually put more commonly used matrix blocks at the top, and/or order them in a way that makes sense for the given block types.

Steps to reproduce

  1. In a Craft 4 site, create a Matrix field with several matrix block types. Note the existing order of the block types.
  2. Upgrade the site to Craft 5.
  3. Check the order of the migrated entry types in the matrix field.

Expected behavior

The order should be preserved during the upgrade.

Actual behavior

The order is not preserved, the blocks are shuffled around.

Craft CMS version

5.5.5

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions