payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
23.58k stars 1.5k forks source link

Admin crashes when I use code field type #7983

Closed zelenovsky closed 1 month ago

zelenovsky commented 1 month ago

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: N/A
  pnpm: 9.5.0
Relevant Packages:
  payload: 3.0.0-beta.95
  next: 15.0.0-canary.104
  @payloadcms/db-postgres: 3.0.0-beta.95
  @payloadcms/graphql: 3.0.0-beta.95
  @payloadcms/next/utilities: 3.0.0-beta.95
  @payloadcms/richtext-lexical: 3.0.0-beta.95
  @payloadcms/translations: 3.0.0-beta.95
  @payloadcms/ui/shared: 3.0.0-beta.95
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12

Describe the Bug

When I add code fields the app crashes with error: TypeError: Cannot read properties of null (reading 'length')

Reproduction Steps

  1. add field to your collection:
    {
    label: "Dark CSS",
    name: "theme_dark_css",
    type: "code",
    admin: {
        language: "css",
    },
    },
  2. go to /admin/collections/your_collection_name?limit=10

Adapters and Plugins

No response

rilrom commented 1 month ago

I was able to reproduce this but restarting the dev server resolved it for me.

zelenovsky commented 1 month ago

@rilrom it hasn't worked out in my case

rilrom commented 1 month ago

You're right, after some more trial and error I can consistently get the error to appear.

paulpopus commented 1 month ago

Fixed in https://github.com/payloadcms/payload/pull/7994

github-actions[bot] commented 3 weeks ago

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