craftcms / craftcms/cms

[4.x]: Matrix Field can't save new fields

Open
#12,917 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug craft4
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

If I save a Matrix field twice, the new fields are gone.

I've migrated a craft 3 install to craft 4 some time ago and it is very janky.

I have a matrix field which at first glance lets me edit and add new fields. But if I go into the field settings a second time, all new fields are gone.

See here:

Steps to reproduce
  1. Open the field settings of a matrix field
  2. Create a new field
  3. Save
  4. Open the field again
  5. The new field is gone

See here: https://somup.com/c0ebl1y5wF

  • No error shows up in the logs
  • It seems to be only happening in these three fieldtypes GIPHY Youtube Video

Bildschirmfoto 2023-03-17 um 13 27 39

When I check craft_matrixblocktypes in the db these fields have a fieldLayoutId value of NULL. Does this have anything to do with it?

Bildschirmfoto 2023-03-17 um 13 24 42

Craft CMS version

4.4.3

PHP version

8.8.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with a Matrix field in the reported Craft CMS 4.4.3 migration scenario, focusing on the GIPHY, Youtube, and Video field types. Inspect the saved craft_matrixblocktypes records and their fieldLayoutId values; done means newly created fields remain present after reopening and saving the field settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.