Skip to content

Preserve the order of bard and replicator sets - #604

Merged
ryanmitchell merged 5 commits into
statamic:5.xfrom
lazerg:fix/issue-15152-bard-set-order
Aug 11, 2026
Merged

Preserve the order of bard and replicator sets#604
ryanmitchell merged 5 commits into
statamic:5.xfrom
lazerg:fix/issue-15152-bard-set-order

Conversation

@lazerg

@lazerg lazerg commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Reordering the sets on a Bard or Replicator field doesn't stick when blueprints are stored with the eloquent driver on MySQL. MySQL sorts the keys of a JSON object when it stores it, so the sets come back out in a different order to the one they went in with.

The blueprint repository already works around this for tabs and sections by keeping a __count on each of them. This does the same for the set groups and sets nested in a field's config, and strips it back out when the blueprint is read or exported. The import command gets it too, since it writes to the database without going through the repository.

Fieldsets have the same problem and aren't covered here, as FieldsetRepository does no order handling at all and would need its own pass. Happy to follow up with that if you want it.

Fixes statamic/cms#15152.

Comment thread tests/Data/Fields/BlueprintTest.php Outdated
@ryanmitchell

Copy link
Copy Markdown
Contributor

I've applied it to fieldsets too for completeness. thanks for your work on this.

@ryanmitchell
ryanmitchell merged commit e8d209f into statamic:5.x Aug 11, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of Bard Sets Not Saved

2 participants