Skip to content

Issue: Field Group fields cause "Objects are not valid as a React child" on Dashboard #678

@matfantinel

Description

@matfantinel

Describe the bug
I've started using fieldGroups in my Frontmatter config to add a "tag" object, defined in frontmatter.json like this:

"frontMatter.taxonomy.fieldGroups": [
{
	"id": "tag",
	"labelField": "label",
	"fields": [
		{
			"title": "Label",
			"name": "label",
			"type": "string",
			"single": true
		},
		{
			"title": "Color",
			"name": "color",
			"type": "choice",
			"choices": ["primary", "secondary"]
		}
	]
}
]

This is used in a content type called "Work Experience", and the Tags prop is defined like this:

	"frontMatter.taxonomy.contentTypes": [		
		{
			"name": "Work Experience",
			"fields": [
				{
					"title": "Tags",
					"name": "tags",
					"type": "block",
					"fieldGroup": ["tag"]
				}
			]
		},

The UI for adding Tags is displayed correctly, and adding tags through it results in something like this:

tags:
  - label: Svelte
    color: primary
    fieldGroup: tag

However, when after saving the file, the Dashboard immediately crashes. On developer tools, I was able to get the error message:

Objects are not valid as a React child (found: object with keys {label, color, fieldGroup}). If you meant to render a collection of children, use an array instead.

Removing the tags field or leaving it empty ([]) makes the dashboard open again.

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repo (make sure to use the cmsify branch)
  2. Open the Frontmatter Dashboard
  3. The content with the tags is in the cms/work-experiences folder

Expected behavior
I expect the dashboard to open

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions