Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two array fields with single upload field breaks admin data loading. #8690

Closed
ckruppe opened this issue Oct 14, 2024 · 3 comments
Closed

Two array fields with single upload field breaks admin data loading. #8690

ckruppe opened this issue Oct 14, 2024 · 3 comments
Assignees

Comments

@ckruppe
Copy link

ckruppe commented Oct 14, 2024

Link to reproduction

No response

Environment Info

Binaries:
Node: 20.11.1
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
payload: 3.0.0-beta.113
next: 15.0.0-canary.173
@payloadcms/db-mongodb: 3.0.0-beta.113
@payloadcms/graphql: 3.0.0-beta.113
@payloadcms/live-preview: 3.0.0-beta.113
@payloadcms/live-preview-react: 3.0.0-beta.113
@payloadcms/next/utilities: 3.0.0-beta.113
@payloadcms/plugin-nested-docs: 3.0.0-beta.113
@payloadcms/plugin-seo: 3.0.0-beta.113
@payloadcms/richtext-lexical: 3.0.0-beta.113
@payloadcms/richtext-slate: 3.0.0-beta.113
@payloadcms/translations: 3.0.0-beta.113
@payloadcms/ui/shared: 3.0.0-beta.113
react: 19.0.0-rc-3edc000d-20240926
react-dom: 19.0.0-rc-3edc000d-20240926
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32488
Available CPU cores: 16

Describe the Bug

Havingf two array fields with one upload each breaks the data loading in admin edit view. The first array gets saved but not loaded in admin panel (it appears empty). The second gets loaded correctly.
Database Entry:

{
  "_id": {
    "$oid": "670d31fed4b7c94af3766024"
  },
  "name": "Test",
  "slider": [
    {
      "data": "670d317ed4b7c94af3765f83",
      "id": "670d31fe6194a5b41856b646"
    },
    {
      "data": "670d31a3d4b7c94af3765fc0",
      "id": "670d31fe6194a5b41856b647"
    },
    {
      "data": "670d31f3d4b7c94af3765ffd",
      "id": "670d31fe6194a5b41856b648"
    }
  ],
  "createdAt": {
    "$date": "2024-10-14T15:00:14.084Z"
  },
  "updatedAt": {
    "$date": "2024-10-14T15:05:11.215Z"
  },
  "__v": 0,
  "content": [
    {
      "contentData": "670d31f3d4b7c94af3765ffd",
      "id": "670d330a32ca0cb418cbe246"
    },
    {
      "contentData": "670d315cd4b7c94af3765f09",
      "id": "670d331132ca0cb418cbe247"
    },
    {
      "contentData": "670d316fd4b7c94af3765f46",
      "id": "670d332032ca0cb418cbe248"
    }
  ]
}

The admin after reloading:
Image

The Collection config:

export const Products: CollectionConfig = {
    access: {
        admin: authenticated,
        create: authenticated,
        delete: authenticated,
        read: authenticated,
        update: authenticated
    },
    admin: {
        defaultColumns: ['name', 'createdAt', 'updatedAt'],
        description: 'Eine Liste aller Admin-User.',
        group: 'App Daten',
        useAsTitle: 'name'
    },
    fields: [
        {
            label: 'Name',
            name: 'name',
            required: true,
            type: 'text'
        },
        {
            editor: lexicalEditor({
                /**
                 *
                 */
                features() {
                    return [
                        InlineToolbarFeature(),
                        UnderlineFeature(),
                        ItalicFeature(),
                        ParagraphFeature(),
                        BoldFeature(),
                        HeadingFeature({enabledHeadingSizes: ['h1', 'h2', 'h3', 'h4']}),
                        UnorderedListFeature()
                    ];
                }
            }),
            label: 'Beschreibung',
            name: 'description',
            type: 'richText'
        },
        {
            fields: [
                {
                    displayPreview: true,
                    label: 'Content',
                    name: 'contentData',
                    relationTo: 'media',
                    required: true,
                    type: 'upload'
                }
            ],
            label: 'Media Content',
            name: 'content',
            type: 'array'
        },
        {
            fields: [
                {
                    displayPreview: true,
                    label: 'Content',
                    name: 'data',
                    relationTo: 'media',
                    required: true,
                    type: 'upload'
                }
            ],
            label: 'Slider Content',
            name: 'slider',
            type: 'array'
        },
        {
            collection: 'image-maps',
            label: 'Zugehörige Image Maps',
            name: 'relatedImageMaps',
            on: 'hotspots.products',
            type: 'join'
        }
    ],
    slug: 'products'
};

Reproduction Steps

1.) Create an collection like above.
2.) Upload data into both arrays.
3.) Reload page.

Adapters and Plugins

No response

@ckruppe ckruppe added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Oct 14, 2024
@ckruppe
Copy link
Author

ckruppe commented Oct 14, 2024

Update: If i split up both array fields in their own tabs it is working again.

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 15, 2024
DanRibbens pushed a commit that referenced this issue Oct 16, 2024
Fixes #8690

Fixes an issue where unrelated schema paths were being joined and passed
into nested sanitizeFields function calls.
Copy link
Contributor

🚀 This is included in version v3.0.0-beta.115

Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants