npm payload 3.0.0-beta.56
v3.0.0-beta.56

2 days ago

v3.0.0-beta.56 (2024-06-28)

Features

  • richtext-lexical: simplify schemaMap handling (#6980) (368dd2c)
  • show detailed validation errors in console (#6551) (8f346df)
  • richtext-lexical: export SerializedHeadingNode, add default node types (#6978) (75a3040)
  • ui: expose CheckboxInput, SelectInput and DatePicker (#6972) (9cdcf20)
  • next: allows auth strategies to return headers that need to be… (#6964) (37e2da0)
  • adds refresh hooks (#6965) (07f3f27)
  • richtext-lexical: new FieldsDrawer utility, improve blocks feature performance (#6967) (0017c67)
  • richtext-lexical: new FieldsDrawer utility (0a42281)
  • ui: export SaveButton / SaveDraftButton components (#6952) (4404a3c)
  • richtext-lexical: upgradeLexicalData function (#6949) (8e232e6)

Bug Fixes

  • plugin-seo: data types plugin seo (#6979) (559c064)
  • richtext-lexical: remove unnecessary JSON.parse(JSON.stringify()) of blocks feature formData (69a42fa)
  • properly cases custom collection components (#6948) (70957b0)

BREAKING CHANGES

  • show detailed validation errors in console (#6551) (8f346df)

ValidationError now requires the global or collection slug, as well as an errors property. The actual errors are no longer at the top-level.

Changed the data to correctly match type generic being sent to the
generate functions. So now you can type your generateTitle etc.
functions like this

// before
const generateTitle: GenerateTitle = async <Page>({ doc, locale }) => {
  return `Website.com — ${doc?.title?.value}`
}


// curent
import type { GenerateDescription, GenerateTitle, GenerateURL } from '@payloadcms/plugin-seo/types'
import type { Page } from './payload-types'

const generateTitle: GenerateTitle<Page> = async ({ doc, locale }) => {
  return `Website.com — ${doc?.title}`
}

const generateDescription: GenerateDescription<Page> = async ({ doc, locale }) => {
  return doc?.excerpt || 'generated description'
}

const generateURL: GenerateURL<Page> = async ({ doc, locale }) => {
  return `https://yoursite.com/${locale ? locale + '/' : ''}${doc?.slug || ''}`
}

Breaking change because it was previously a FormState value.

  • next: allows auth strategies to return headers that need to be… (#6964) (37e2da0)

Some authentication strategies may need to set headers for responses,
such as updating cookies via a refresh token, and similar. This PR
extends Payload's auth strategy capabilities with a manner of
accomplishing this.

This is a breaking change if you have custom authentication strategies
in Payload's 3.0 beta. But it's a simple one to update.

Instead of your custom auth strategy returning the user, now you must
return an object with a user property.

This is because you can now also optionally return responseHeaders,
which will be returned by Payload API responses if you define them in
your auth strategies. This can be helpful for cases where you need to
set cookies and similar, directly within your auth strategies.

Before:

return user

After:

return { user }
  • properly cases custom collection components (#6948) (70957b0)

Properties within the Custom Collection Components config were not
properly cased. In the Payload Config, there are places where we expose
an array of Custom Components to render. These properties should be
cased in camelCase to indicate that its type is not a component,
but rather, it's an array of components. This is how all other
arrays are already cased throughout the config, therefore these
components break exiting convention. The CapitalCase convention is
reserved for components themselves, however, fixing this introduces a
breaking change. Here's how to migrate:

Old:

{
 // ...
 admin: {
   components: {
     AfterList: [],
     AfterListTable: [],
     BeforeList: [],
     BeforeListTable: [],
   }
  }
}

New:

{
 // ...
 admin: {
   components: {
     afterList: [],
     afterListTable: [],
     beforeList: [],
     beforeListTable: [],
   }
 }
}

The docs were also out of date for the Root-level Custom Components.
These components are documented in CaptalCase but are in fact cased
correctly in Payload. This PR fixes that.

Contributors

Don't miss a new payload release

NewReleases is sending notifications on new releases.