WIP: 500 Error when saving if components select prop is empty

See the screenshots below. I forgot to choose classes in the prop options. But I could still select the option for the component instance even when it was actually empty value. When I saved the page there was an error 500.


Also having this error now after inserting component with Global Classes props into another component. Whole builder preview broke on every page (even without components inserted). I downgraded to 1.2.4, saved the pages and then upgraded to 2.0-beta. Now the pages are not broken but I can’t use Global Classes props:

Hi @jiripaulas,

I am unable to replicate the issue with the empty component class property, using 2.0 beta version.

Can you export your component, and paste it here?

Thank you,
Matej

I don’t have the original component but I remade it. It actually saves this one without error but then shows this warning after setting the “empty” class through selectbox:

Warning: foreach() argument must be of type array|object, string given in /Users/jiripaulas/Local Sites/estatex/app/public/wp-content/themes/bricks/includes/assets.php on line 3271

The component:

{
  "components": [
    {
      "id": "ppqmin",
      "category": "Menus",
      "desc": "",
      "elements": [
        {
          "id": "ppqmin",
          "name": "block",
          "parent": 0,
          "children": [
            "pztdlj",
            "ymjrrs",
            "idohaf",
            "yganfq"
          ],
          "settings": {
            "_cssGlobalClasses": [
              "mwbghl"
            ],
            "tag": "ul"
          },
          "properties": {
            "zpcafc": "wdfrvl",
            "rcqwou": "opmeka"
          },
          "label": "My Main Menu"
        },
        {
          "id": "pztdlj",
          "name": "block",
          "parent": "ppqmin",
          "children": [
            "xloymc"
          ],
          "settings": {
            "_cssGlobalClasses": [
              "9p7cif"
            ],
            "tag": "li"
          },
          "label": "Item"
        },
        {
          "id": "xloymc",
          "name": "text-link",
          "parent": "pztdlj",
          "children": [],
          "settings": {
            "text": "Kupuji",
            "_cssGlobalClasses": [
              "p0vs26"
            ],
            "link": {
              "type": "internal",
              "postId": "681"
            }
          },
          "label": "Link"
        },
        {
          "id": "ymjrrs",
          "name": "block",
          "parent": "ppqmin",
          "children": [
            "lcmutx"
          ],
          "settings": {
            "_cssGlobalClasses": [
              "9p7cif"
            ],
            "tag": "li"
          },
          "label": "Item"
        },
        {
          "id": "lcmutx",
          "name": "text-link",
          "parent": "ymjrrs",
          "children": [],
          "settings": {
            "text": "Prodávám",
            "_cssGlobalClasses": [
              "p0vs26"
            ],
            "link": {
              "type": "internal",
              "postId": "482"
            }
          },
          "label": "Link"
        },
        {
          "id": "idohaf",
          "name": "block",
          "parent": "ppqmin",
          "children": [
            "waonpy"
          ],
          "settings": {
            "_cssGlobalClasses": [
              "9p7cif"
            ],
            "tag": "li"
          },
          "label": "Item"
        },
        {
          "id": "waonpy",
          "name": "text-link",
          "parent": "idohaf",
          "children": [],
          "settings": {
            "text": "Odhad ceny",
            "_cssGlobalClasses": [
              "p0vs26"
            ],
            "link": {
              "type": "internal",
              "postId": "482"
            }
          },
          "label": "Link"
        },
        {
          "id": "yganfq",
          "name": "block",
          "parent": "ppqmin",
          "children": [
            "mvzeps"
          ],
          "settings": {
            "_cssGlobalClasses": [
              "9p7cif"
            ],
            "tag": "li"
          },
          "label": "Item"
        },
        {
          "id": "mvzeps",
          "name": "text-link",
          "parent": "yganfq",
          "children": [],
          "settings": {
            "text": "Přihlásit se",
            "_cssGlobalClasses": [
              "p0vs26"
            ]
          },
          "label": "Link"
        }
      ],
      "_created": 1748621913,
      "_user_id": 1,
      "_version": "2.0-beta",
      "properties": [
        {
          "label": "Local classes",
          "type": "text",
          "default": "my-menu--desktop",
          "id": "qvsbgw",
          "connections": {
            "ppqmin": [
              "_cssClasses"
            ]
          }
        },
        {
          "label": "Mobile/desktop",
          "type": "class",
          "options": [
            {
              "id": "stfmkf",
              "label": "Desktop",
              "value": null
            },
            {
              "id": "mzgjws",
              "label": "Mobile",
              "value": null
            }
          ],
          "id": "wxhfmp",
          "connections": {
            "ppqmin": [
              "_cssGlobalClasses"
            ]
          }
        }
      ]
    }
  ],
  "globalClasses": [
    {
      "id": "mwbghl",
      "name": "my-menu",
      "settings": {
        "_padding": {
          "left": "0"
        },
        "_display": "flex",
        "_direction": "row",
        "_columnGap": "var(--space-m)",
        "_width": "auto"
      },
      "modified": 1748625392,
      "user_id": 1
    },
    {
      "id": "9p7cif",
      "name": "my-menu__item",
      "settings": {
        "_width": "auto"
      }
    },
    {
      "id": "p0vs26",
      "name": "my-menu__link",
      "settings": {
        "_typography": {
          "text-transform": "uppercase",
          "font-weight": "400",
          "font-size": "calc(var(--text-m) * 0.9)",
          "text-decoration": "none"
        },
        "_cssCustom": ".my-menu__link:hover {\n  color: var(--primary-light);\n}"
      },
      "modified": 1748617506,
      "user_id": 1
    },
    {
      "id": "9p7cif",
      "name": "my-menu__item",
      "settings": {
        "_width": "auto"
      }
    },
    {
      "id": "p0vs26",
      "name": "my-menu__link",
      "settings": {
        "_typography": {
          "text-transform": "uppercase",
          "font-weight": "400",
          "font-size": "calc(var(--text-m) * 0.9)",
          "text-decoration": "none"
        },
        "_cssCustom": ".my-menu__link:hover {\n  color: var(--primary-light);\n}"
      },
      "modified": 1748617506,
      "user_id": 1
    },
    {
      "id": "9p7cif",
      "name": "my-menu__item",
      "settings": {
        "_width": "auto"
      }
    },
    {
      "id": "p0vs26",
      "name": "my-menu__link",
      "settings": {
        "_typography": {
          "text-transform": "uppercase",
          "font-weight": "400",
          "font-size": "calc(var(--text-m) * 0.9)",
          "text-decoration": "none"
        },
        "_cssCustom": ".my-menu__link:hover {\n  color: var(--primary-light);\n}"
      },
      "modified": 1748617506,
      "user_id": 1
    },
    {
      "id": "9p7cif",
      "name": "my-menu__item",
      "settings": {
        "_width": "auto"
      }
    },
    {
      "id": "p0vs26",
      "name": "my-menu__link",
      "settings": {
        "_typography": {
          "text-transform": "uppercase",
          "font-weight": "400",
          "font-size": "calc(var(--text-m) * 0.9)",
          "text-decoration": "none"
        },
        "_cssCustom": ".my-menu__link:hover {\n  color: var(--primary-light);\n}"
      },
      "modified": 1748617506,
      "user_id": 1
    }
  ]
}

Hi @jiripaulas,

thank you. I was able to replicate the issue then, and I’ve created a task internally - so this should be fixed in the next release.

We will also update this topic, once we release it.

Best regards,
Matej

1 Like