Home

>

Tools

>

Payload CMS

>

Releases

>

3.0.0-beta.43

Payload CMS Release: 3.0.0-beta.43

Pre Release

Tag Name: v3.0.0-beta.43

Release Date: 6/7/2024

Payload CMS LogoPayload CMS

Payload CMS is a modern, self-hosted headless content management system built with TypeScript, Node.js, and MongoDB. It's designed specifically for developers who want full control over their content management system while maintaining a powerful admin interface for content editors.

TL;DR

PayloadCMS v3.0.0-beta.43 introduces several important updates including draft validation capabilities, improved plugin-redirects field overrides, and Node.js version requirement changes. This release includes two breaking changes: the minimum Node.js 20 version is now 20.9.0 (up from 20.6.0), and the plugin-redirects fields override now uses a function-based approach. Additionally, it fixes issues with global versioning and Next.js live preview positioning.

Highlight of the Release

    • Draft validation can now be enabled at the collection config level
    • Plugin-redirects fields override now uses a function-based approach for better flexibility
    • Rich text fields can omit the root editor property to reduce bundle size
    • Minimum Node.js 20 version requirement increased to 20.9.0
    • Fixed global versioning limits not being respected
    • Improved Next.js live preview device positioning when using zoom

Migration Guide

Upgrading Node.js Version

If you're using Node.js 20, you'll need to upgrade to at least version 20.9.0. This is required because version 20.6.0 has a CommonJS bug that breaks type generation. If you're using Node.js 18, you can continue using version 18.20.2 or higher.

# Check your current Node.js version
node -v

# If using nvm to manage Node.js versions
nvm install 20.9.0
nvm use 20.9.0

Updating Plugin-Redirects Field Overrides

If you're using the plugin-redirects module and have customized fields, you'll need to update your code to use the new function-based approach:

// Before
overrides: {
  fields: [
    {
      type: 'text',
      name: 'customField',
    },
  ],
},

// After
overrides: {
  fields: ({ defaultFields }) => {
    return [
      ...defaultFields, // Include default fields if desired
      {
        type: 'text',
        name: 'customField',
      },
    ]
  },
},

This change allows you to access and extend the default fields rather than completely replacing them.

Upgrade Recommendations

Recommended Upgrade Path

This is a beta release with breaking changes, so careful testing is recommended before upgrading production environments.

  1. Update your Node.js version to at least 20.9.0 if you're using Node 20
  2. Update any plugin-redirects field overrides to use the new function-based approach
  3. Test your application thoroughly, especially if you're using globals with versioning or Next.js live preview features
  4. Consider enabling draft validation if your workflow would benefit from validating draft content

For development environments, upgrading is recommended to take advantage of the new features and bug fixes. For production environments, evaluate the impact of the breaking changes before upgrading.

Bug Fixes

Fixed Global Versioning Limits

This release fixes an issue where the maximum versions configuration was not being respected on globals. Previously, global versions could exceed the configured limit, potentially causing performance issues and unnecessary database growth. The fix ensures that version limits are properly enforced for globals, maintaining consistent behavior with collections.

Improved Next.js Live Preview Device Positioning

Fixed an issue with the Next.js live preview device positioning when using zoom. Previously, the preview could appear misaligned or incorrectly positioned when zoom was applied, making it difficult to accurately preview content. This fix ensures that the preview device maintains proper positioning regardless of zoom level.

New Features

Draft Validation Option

You can now enable validation for draft documents at the collection config level. This feature allows you to ensure that drafts meet validation requirements before they're saved, which can help maintain data integrity even for unpublished content.

// Collection config
versions: {
  drafts: {
    validate: true // defaults to false
  }
}

Function-Based Fields Override for Plugin-Redirects

The plugin-redirects module now uses a function-based approach for field overrides, providing more flexibility and control. This allows you to access and extend the default fields rather than completely replacing them.

// New approach
overrides: {
  fields: ({ defaultFields }) => {
    return [
      ...defaultFields, // Keep all default fields
      {
        type: 'text',
        name: 'customField',
      },
    ]
  },
},

Optional Root Editor Property for Rich Text Fields

You can now omit the root editor property in rich text field configurations. This optimization allows for smaller bundle sizes when not using rich text fields in your Payload application, as it prevents including Lexical or Slate in your bundle unnecessarily.

Security Updates

No specific security fixes were included in this release.

Performance Improvements

Reduced Bundle Size for Applications Not Using Rich Text

By allowing the omission of the root editor property in rich text configurations, applications that don't use rich text fields can now avoid including Lexical or Slate in their bundles. This can lead to significant bundle size reductions and improved load times for applications that don't require rich text editing capabilities.

Added Turbo Resolve Alias Mock

A turbo resolve alias mock was added to hide webpack warnings, which helps clean up the development experience by reducing unnecessary console noise during builds.

Impact Summary

This release introduces important improvements to PayloadCMS with two breaking changes that require attention during upgrade. The Node.js version requirement change addresses a critical type generation bug, while the plugin-redirects field override change provides more flexibility but requires code updates.

The addition of draft validation is significant for content workflows that require data integrity even for unpublished content. The ability to omit the root editor property for rich text fields can provide performance benefits for applications that don't use rich text editing.

Bug fixes for global versioning and Next.js live preview improve reliability and user experience. Overall, this beta release continues to refine PayloadCMS's feature set and stability as it moves toward a stable 3.0 release.

Developers should pay particular attention to the breaking changes and update their environments accordingly, but the improvements in functionality and performance make this update worthwhile for most users.

Full Release Notes

v3.0.0-beta.43 (2024-06-07)

Features

  • adds draft validation option (#6677) (52c81ad)
  • plugin-redirects: update fields overrides to use a function (#6675) (e4a9029)
  • richtext-*: allow omitting the root editor property (#6660) (11c3a65)
  • upgrade minimum node 20 version from 20.6.0 to 20.9.0 (#6659) (9bd9e7a)

Bug Fixes

  • next: live preview device position when using zoom (#6665) (7c8d562)
  • max versions config not being respected on globals (#6654) (8dd5e4d)

BREAKING CHANGES

  • plugin-redirects: update fields overrides to use a function (#6675) (e4a9029)

Description

Updates the fields override in plugin redirects to allow for
overriding

// before
overrides: {
  fields: [
    {
      type: 'text',
      name: 'customField',
    },
  ],
},

// current
overrides: {
  fields: ({ defaultFields }) => {
    return [
      ...defaultFields,
      {
        type: 'text',
        name: 'customField',
      },
    ]
  },
},
  • upgrade minimum node 20 version from 20.6.0 to 20.9.0 (#6659) (9bd9e7a)
  • This bumps the minimum required node version from node 20.6.0 to node
    20.9.0. This is because 20.6.0 breaks type generation due to a CJS node
    bug, and 20.9.0 is the next v20 LTS version. The minimum node 18 version
    stays the same (18.20.2)

Contributors

Statistics:

File Changed86
Line Additions1,016
Line Deletions290
Line Changes1,306
Total Commits9

User Affected:

  • Need to update to Node.js 20.9.0+ if using Node 20 (Node 18.20.2+ still supported)
  • Must update plugin-redirects field overrides to use the new function-based approach
  • Can now enable validation for draft documents
  • Can omit the root editor property in richtext fields for smaller bundle sizes

Contributors:

AlessioGrpaulpopusjacobsfletchJarrodMFleschdenolfe