Skip to content

regression: Export with toCSV does not include all columns #15345

@MichielDeMey

Description

@MichielDeMey

Describe the Bug

When exporting data with the fields parameter to select specific fields (e.g., fields: ['member']), the export fails to include nested/child fields that should be included when using the toCSV functionality.

This regression was most likely introduced in PR #14782 which refactored the plugin.

Data is missing from both the export file as well as the preview table.

Current behaviour: Export File Contains:

id,member
1,user_id_here

Preview Table Shows:

  • Only column header: "member"
  • Missing: member_name, member_email

What's Missing:

  • member_name column (should show "John Doe")
  • member_email column (should show "john@example.com")

Expected behaviour: Export File Contains:

id,member_name,member_email
1,"John Doe","john@example.com"

Preview Table Shows:

  • Column headers: "id", "member_name", "member_email"
  • Data properly displayed in all columns

Link to the code that reproduces this issue

https://github.com/dnd-gent/payloadcms-export-regression

Reproduction Steps

Reproduction Steps

1. Setup Environment

# Clone the reproduction repository
git clone https://github.com/dnd-gent/payloadcms-export-regression
cd payloadcms-export-regression

# Install dependencies
pnpm install

# Start the development server
pnpm dev

2. Create Test Data

  1. Navigate to http://localhost:3000/admin
  2. Go to Users collection
  3. Create a user:
  4. Go to Signups collection
  5. Create a signup:
    • Member: Select "John Doe"
    • Status: "confirmed"
    • Save

3. Reproduce the Bug

  1. In the Signups collection list view
  2. Click the "Export" button
  3. In the export dialog:
    • Format: CSV
    • Fields: ["member"]
  4. Click "Preview" to see the preview table

4. Observe the Issue

Which area(s) are affected?

plugin: import-export

Environment Info

Binaries:
  Node: 20.20.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 10.28.1
Relevant Packages:
  payload: 3.73.0
  next: 15.4.10
  @payloadcms/db-sqlite: 3.73.0
  @payloadcms/drizzle: 3.73.0
  @payloadcms/graphql: 3.73.0
  @payloadcms/next/utilities: 3.73.0
  @payloadcms/plugin-import-export: 3.73.0
  @payloadcms/richtext-lexical: 3.73.0
  @payloadcms/translations: 3.73.0
  @payloadcms/ui/shared: 3.73.0
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:45 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions