Giter Club home page Giter Club logo

Comments (3)

vixalien avatar vixalien commented on July 22, 2024

having the same error, except for me the application doesn't start all. Here's my code.

UploadFeature({
  collections: {
    media: {
      fields: [
        {
          name: "caption",
          label: "Caption",
          type: "richText",
          editor: lexicalEditor({
            features: () => [
              ParagraphFeature(),
              ...defaultCMSFeatures,
            ],
          }),
        },
      ],
    },
  },
}),

Stack:

file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/promise.js:23
    const shouldHoistLocalizedValue = flattenLocales && fieldAffectsData(field) && typeof siblingDoc[field.name] === 'object' && siblingDoc[field.name] !== null && field.localized && locale !== 'all' && req.payload.config.localization;
                                                                                                    ^

TypeError: Cannot read properties of null (reading 'caption')
    at promise (file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/promise.js:23:101)
    at file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/traverseFields.js:4:28
    at Array.forEach (<anonymous>)
    at Module.traverseFields (file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/traverseFields.js:3:12)
    at hooks.afterRead (/home/alien/sites/rwarri.org/node_modules/.pnpm/@[email protected]_oya34g7zejj37344dtca3uxyqm/node_modules/@payloadcms/richtext-lexical/dist/index.js:286:59)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/promise.js:515:49
    at async promise (file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/promise.js:477:21)
    at async Promise.all (index 6)
    at async afterRead (file:///home/alien/sites/rwarri.org/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]/node_modules/payload/dist/fields/hooks/afterRead/index.js:41:5)

Node.js v22.1.0

from payload.

AlessioGr avatar AlessioGr commented on July 22, 2024

Fixed in 7c8857a (#6885).

Please re-open if this issue still appears in the upcoming 3.0.0-beta.54 release

from payload.

carlonoelle avatar carlonoelle commented on July 22, 2024

I have a related problem i think, my extra fields aren't showing up at all:

edit-fields-missing.mov

My RichText Field Config:

import { type RichTextField } from "payload"
import { FeatureProviderServer, UploadFeature, lexicalEditor } from "@payloadcms/richtext-lexical"
import link from "../link"
import { defaultFeatures } from "./defaultFeatures"
import deepMerge from "@/payload/utilities/deepMerge"

type RichText = (
  overrides?: Partial<RichTextField>,
  additions?: {
    features?: FeatureProviderServer[]
  }
) => RichTextField

const richText: RichText = (
  overrides,
  additions = {
    features: [],
  }
) =>
  deepMerge<RichTextField, Partial<RichTextField>>(
    {
      name: "richText",
      editor: lexicalEditor({
        features: () => [
          ...[...defaultFeatures, ...(additions.features || [])],
          UploadFeature({
            collections: {
              media: {
                hasExtraFields: true,
                fields: [
                  {
                    name: "caption",
                    editor: lexicalEditor({
                      features: () => [...defaultFeatures],
                    }),
                    label: "Caption",
                    type: "richText",
                  },
                  {
                    name: "alignment",
                    label: "Alignment",
                    options: [
                      {
                        label: "Left",
                        value: "left",
                      },
                      {
                        label: "Center",
                        value: "center",
                      },
                      {
                        label: "Right",
                        value: "right",
                      },
                    ],
                    type: "radio",
                  },
                  {
                    name: "enableLink",
                    label: "Enable Link",
                    type: "checkbox",
                  },
                  /* link({
                    appearances: false,
                    disableLabel: true,
                    overrides: {
                      admin: {
                        condition: (_: any, data: any) => Boolean(data?.enableLink),
                      },
                    },
                  }), */
                ],
              },
            },
          }),
        ],
      }),
      required: true,
      type: "richText",
    },
    overrides || {}
  )

export default richText

I am using all payload packages at Version 3.0.0-beta.60.

I would expect to see my extra fields: Caption (Richtext), Alignment (radio), enableLink (checkbox)

from payload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.