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

Plugin not working with new database #85

Open
gonzam88 opened this issue Oct 28, 2024 · 0 comments
Open

Plugin not working with new database #85

gonzam88 opened this issue Oct 28, 2024 · 0 comments

Comments

@gonzam88
Copy link

I was using this plugin (slug field specifically) in development with an already initialized payload. Worked fine. When deployed to an empty project it threw an error. Reproduced with empty project.
Steps to reproduce

  1. Start new payload project npx create-payload-app@latest
  2. Add better fields yarn add @nouance/payload-better-fields-plugin
  3. Add slug field to users collection
import { CollectionConfig } from 'payload/types'
import { SlugField } from '@nouance/payload-better-fields-plugin'

const Users: CollectionConfig = {
  slug: 'users',
  auth: true,
  admin: {
    useAsTitle: 'email',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...SlugField(
      {
        name: 'slug',
        admin: {
          position: 'sidebar',
        },
      },
      {
        useFields: ['title', 'subtitle'],
      },
    ),
  ],
}

export default Users
  1. Run docker docker-compose up and open localhost:3000

Error reports Component.js:78 Uncaught TypeError: Cannot read properties of undefined (reading 'value') pointing to this line return fields .filter(function (item) { return Boolean(item.value); })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant