payloadcms / payloadcms/payload

[plugin-import-export] Prefix labels being applied to row fields and unnamed/unlabelled group fields in export fields dropdown

Open Beginner friendly
#17,882 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: ui status: needs-triage v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug.

Prefix labels are being applied to row fields and unnamed/unlabelled group fields in the Export Options Fields dropdown.

Example:

{
  type: 'row',
  fields: [
    {
      type: 'text',
      name: 'test1',
      label: 'Test1'
    },
    {
      type: 'text',
      name: 'test2',
      label: 'Test2'
    }
  ]
}
Image

Suggested fix — Prefix labels should be removed in these instances. Change how fields are being reduced in packages/plugin-import-export/src/components/FieldsToExport/reduceFields.tsx

if (!isArrayOrBlocks && fieldHasSubFields(field)) {
  const affectsData = fieldAffectsData(field)

  return [
    ...fieldsToUse,
    ...reduceFields({
      disabledFields,
      excludeUnsortable,
      fields: field.fields,
      labelPrefix: affectsData
        ? combineLabel({
            field,
            prefix: labelPrefix,
          })
        : labelPrefix,
      path: createNestedClientFieldPath(path, field)
    })
  ]
}
Reproduction Steps
  1. Install the plugin-import-export plugin
  2. Enable the plugin-import-export plugin on a collection in the payload.config
  3. In your collection, add the fields:
{
  type: 'row',
  fields: [
    {
      type: 'text',
      name: 'test1',
      label: 'Test1'
    },
    {
      type: 'text',
      name: 'test2',
      label: 'Test2'
    }
  ]
}
  1. Open the exports modal/drawer on the collection list view and select Export
  2. Select the fields defined in step 3 in the Export Options Fields dropdown
Environment Info
Payload: 3.85.1
Node.js: 22.17.0
Next.js: 16.2.6

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 in packages/plugin-import-export/src/components/FieldsToExport/reduceFields.tsx and trace how labels are reduced for row and unnamed group fields. Reproduce the Export Options Fields dropdown with the provided row-field configuration; done when those fields no longer display prefixed labels while other nested field labels retain their intended prefixes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.