Home

>

Tools

>

Payload CMS

>

Releases

>

Release v2.5.0

Payload CMS Release: Release v2.5.0

Tag Name: v2.5.0

Release Date: 12/19/2023

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

Payload CMS v2.5.0 introduces significant enhancements to the rich text editing experience with major updates to the Lexical editor, improved SEO plugin integration, and numerous bug fixes. This release focuses on developer experience improvements, better field handling, and performance optimizations across the platform. Notable changes include breaking changes to the Lexical rich text editor, improved URL validation, and better handling of relationship fields.

Highlight of the Release

    • SEO plugin renamed from 'meta' to 'seo' with improved description generation and title handling
    • Major updates to Lexical rich text editor with breaking changes to component imports and link handling
    • New context property added to auth and globals local API
    • Improved form submission emails functionality
    • Better handling of relationship fields with optimized querying
    • Enhanced admin navigation with smoother transitions
    • Added max file size labels to media fields for better user experience

Migration Guide

Migrating from v2.4.0 to v2.5.0

Breaking Changes in @payloadcms/richtext-lexical

  1. TreeviewFeature Rename

    • Rename all imports of TreeviewFeature to TreeViewFeature (with capital "V")
  2. Link Node Data Format Change

    • If you're reading link node data in your frontend code, update your code:
    • Old format: fields.doc.value.id
    • New format: fields.doc.value
  3. React Component Imports

    • If you're importing React components from Lexical features, update to use dynamic imports:
    // Old
    import { BlockIcon } from '../../lexical/ui/icons/Block'
    ...
    Icon: BlockIcon,
    
    // New
    Icon: () =>
      import('../../lexical/ui/icons/Block').then((module) => module.BlockIcon),
    
  4. ToolbarDropdown Component

    • The ToolbarDropdown component now requires a mandatory sectionKey prop
  5. Package Exports Changes

    • The following exports are now from @payloadcms/richtext-lexical/components:
      • ToolbarButton
      • ToolbarDropdown
      • RichTextCell
      • RichTextField
      • defaultEditorLexicalConfig
  6. Version Synchronization

    • Ensure you update both Payload and @payloadcms/richtext-lexical together to avoid validation errors

SEO Plugin Migration

  • If you were using the meta plugin, it has been renamed to SEO
  • Review your SEO configuration to take advantage of new features like tabbed UI
  • Update any custom components to work with the new plugin structure

General Updates

  • Review relationship fields that use filterOptions as the behavior has been optimized
  • Check upload fields for any issues after the upload-related fixes
  • Test form submission emails if you're using that functionality

Upgrade Recommendations

Priority: Medium-High

This release contains significant improvements to the rich text editing experience and SEO plugin, along with numerous bug fixes that improve stability. The breaking changes are primarily isolated to the Lexical rich text editor.

Who should upgrade immediately:

  • Projects using the SEO/meta plugin
  • Applications with heavy rich text editing requirements
  • Sites experiencing issues with relationship fields or upload handling

Who can wait:

  • Projects not using the Lexical rich text editor or SEO plugin
  • Applications with minimal content editing needs

Upgrade Steps:

  1. Review the breaking changes, especially if using the Lexical rich text editor
  2. Update both Payload and any @payloadcms/* packages together
  3. Test thoroughly in a staging environment before deploying to production
  4. Pay special attention to rich text content and SEO metadata after upgrading

The upgrade is recommended for most users as it brings significant improvements to content editing and developer experience, but those not using the affected features can upgrade at their convenience.

Bug Fixes

SEO Plugin Fixes

  • Fixed meta length indicator
  • Fixed meta image generation and upload field issues
  • Fixed unnecessary pipe character in meta title (#33)
  • Fixed payload config provider integration
  • Fixed image field and type errors
  • Fixed incorrect import paths in documentation

Rich Text Editor Fixes

  • Fixed various type errors throughout the codebase
  • Fixed issues with Lexical HTML field not working inside Blocks field
  • Fixed problems with URL validation for different URL types
  • Fixed unnecessary paragraph elements before upload, relationship and blocks nodes

Admin UI Fixes

  • Added background color for year/month select options in datepicker
  • Fixed cursor jumping issues inside JSON fields
  • Fixed formatting of fields within tabs for list controls
  • Fixed handling of empty arrays in getDataByPath
  • Improved tab handling for better user experience

API and Data Handling

  • Fixed issues with querying relationship fields
  • Fixed handling of default values for fields with read access restrictions
  • Fixed searching by ID which was sending undefined in where query parameters
  • Fixed upload-related issues including cropping, fetching local files, and external preview images

New Features

SEO Plugin Improvements

  • Renamed meta plugin to SEO for better clarity
  • Refined SEO descriptions with improved auto-generation
  • Added subsite inclusion in meta title generation
  • Improved meta image generation and upload field handling
  • Added error handling to meta title generation
  • Added option for tabbed UI interface for better organization
  • Added support for globals configuration

Rich Text Editor Enhancements

  • Improved link URL validation in Lexical editor
  • Enhanced floating select menu with better dropdown classNames
  • Added support for generating URLs in SEO plugin
  • Added dark-mode friendly colors

Admin Experience Improvements

  • Added form submission emails functionality
  • Added max file size labels to media fields
  • Added new actions property to admin customization
  • Improved admin navigation with smoother transitions

Developer Tools

  • Added context property to auth and globals local API
  • Added proper type exports for better TypeScript support
  • Added support for passing locale through generateURL

Security Updates

No specific security fixes were mentioned in the release notes. The release focuses primarily on feature enhancements, bug fixes, and performance improvements rather than addressing security vulnerabilities.

Performance Improvements

Rich Text Editor Performance

  • Lazy import of React components in Lexical editor to prevent client-only code from leaking into the server
  • Improved handling of relationship fields by preventing unnecessary queries when filterOptions returns false

Database Optimizations

  • Fixed PostgreSQL database issues with querying nested blocks fields
  • Improved handling of MongoDB DocumentDB unique constraints
  • Better handling of GraphQL schema generation for fields without queryable subfields

Admin UI Performance

  • Smoother admin navigation transitions for better user experience
  • Improved handling of uploads with better validation flow
  • Optimized form field rendering and state management

Impact Summary

Payload CMS v2.5.0 delivers substantial improvements to the content editing experience, particularly through enhancements to the SEO plugin (formerly meta plugin) and the Lexical rich text editor. The release includes breaking changes to the Lexical editor that require code updates, but these are well-documented and primarily affect developers who have customized the editor.

The SEO plugin has been significantly improved with better meta description generation, title handling, and image support. Content editors will benefit from a more intuitive interface with the optional tabbed UI and better visual feedback for media uploads. Developers gain access to improved APIs, better TypeScript support, and more efficient relationship field handling.

Performance improvements include lazy loading of React components in the Lexical editor and optimized database queries. The admin UI experience has been enhanced with smoother navigation transitions and better form handling.

Overall, this release represents a solid step forward for Payload CMS with meaningful improvements for both developers and content editors. The breaking changes are limited in scope and the migration path is clear, making this a worthwhile upgrade for most users.

Full Release Notes

2.5.0 (2023-12-19)

Features

  • add Chinese Traditional translation (#4372) (50253f6)
  • add context to auth and globals local API (#4449) (168d629)
  • adds new actions property to admin customization (#4468) (9e8f14a)
  • async live preview urls (#4339) (5f17324)
  • pass path to FieldDescription (#4364) (3b8a27d)
  • plugin-form-builder: Lexical support (#4487) (c6c5cab)
  • prevent querying relationship when filterOptions returns false (#4392) (c1bd338)
  • richtext-lexical: improve floating select menu Dropdown classNames (#4444) (9331204)
  • richtext-lexical: improve link URL validation (#4442) (9babf68)
  • richtext-lexical: lazy import React components to prevent client-only code from leaking into the server (#4290) (5de347f)
  • richtext-lexical: Link & Relationship Feature: field-level configurable allowed relationships (#4182) (7af8f29)
  • richtext-lexical: link node: change doc data format to be consistent with relationship field (#4504) (cc0ba89)
  • richtext-lexical: rename TreeviewFeature into TreeViewFeature (#4520) (c49fd66)
  • richtext-lexical: Slate to Lexical converter: add blockquote conversion, convert custom link fields (#4486) (31f8f3c)
  • richtext-lexical: Upload html serializer: Output picture element if the image has multiple sizes, improve absolute URL creation (e558894)

Bug Fixes

  • adds bg color for year/month select options in datepicker (#4508) (07371b9)
  • correctly fetches externally stored files when passing uploadEdits (#4505) (228d45c)
  • cursor jumping around inside json field (#4453) (6300037)
  • db-mongodb: documentDB unique constraint throws incorrect error (#4513) (05e8914)
  • db-postgres: findOne correctly querying with where queries (#4550) (8bc31cd)
  • db-postgres: querying nested blocks fields (#4404) (6e9ae65)
  • db-postgres: sorting on a not-configured field throws error (#4382) (dbaecda)
  • defaultValues computed on new globals (#4380) (b6cffce)
  • disallow duplicate fieldNames to be used on the same level in the config (#4381) (a1d66b8)
  • ensure ui fields do not make it into gql schemas (#4457) (3a20ddc)
  • format fields within tab for list controls (#4516) (2650c70)
  • formats locales with multiple labels for versions locale selector (#4495) (8257661)
  • graphql schema generation for fields without queryable subfields (#4463) (13e3e06)
  • handles null upload field values (#4397) (cf9a370)
  • live-preview: populates rte uploads and relationships (#4379) (4090aeb)
  • live-preview: sends raw js objects through window.postMessage instead of json (#4354) (03a3872)
  • make admin navigation transition smoother (#4217) (eb6572e)
  • omit field default value if read access returns false (#4518) (3e9ef84)
  • pin ts-node versions which are causing swc errors (#4447) (b9c0248)
  • properly spreads collection fields into non-tabbed configs #50 (#51) (7e88159)
  • plugin-form-builder: removes use of slate in rich-text serializer (#4451) (3df52a8)
  • plugin-nested-docs: properly exports field utilities (#4462) (1cc87bd)
  • richtext-*: loosen RichTextAdapter types due to re-occuring ts strict mode errors (#4416) (48f1299)
  • richtext-lexical: Blocks field: should not prompt for unsaved changes due to value comparison between null and non-existent props (#4450) (548e78c)
  • richtext-lexical: do not add unnecessary paragraph before upload, relationship and blocks nodes (#4441) (5c2739e)
  • richtext-lexical: lexicalHTML field not working when used inside of Blocks field (128f9c4)
  • richtext-lexical: lexicalHTML field now works when used inside of row fields (#4440) (0421173)
  • richtext-lexical: not all types of URLs are validated correctly (ac7f980)

... Release notes are cut-off. Click here to continue reading

...........................................

  • searching by id sends undefined in where query param (#4464) (46e8c01)
  • simplifies query validation and fixes nested relationship fields (#4391) (4b5453e)
  • updates return value of empty arrays in getDataByPath (#4553) (f3748a1)
  • upload editing error with plugin-cloud (#4170) (fcbe574)
  • upload related issues, cropping, fetching local file, external preview image (#4461) (45c472d)
  • uploads files after validation (#4218) (65adfd2)

⚠ BREAKING CHANGES: @payloadcms/richtext-lexical

  • richtext-lexical: rename TreeviewFeature into TreeViewFeature (#4520)

If you import TreeviewFeature, you have to rename the import to use TreeViewFeature (capitalized "V")

  • richtext-lexical: link node: change doc data format to be consistent with relationship field (#4504)

An unpopulated, internal link node no longer saves the doc id under fields.doc.value.id. Now, it saves it under fields.doc.value.
Migration inside of payload is automatic. If you are reading from the link node inside of your frontend though, you will have to adjust it.

  • richtext-lexical: improve floating select menu Dropdown classNames (#4444)

ToolbarDropdown react component has a new mandatory sectionKey prop

  • richtext-lexical: lazy import React components to prevent client-only code from leaking into the server (#4290)
  1. Most important: If you are updating @payloadcms/richtext-lexical to v0.4.0 or higher, you will HAVE to update payload to the latest version as well. If you don't update it, payload likely won't start up due to validation errors. It's generally good practice to upgrade packages prefixed with @payloadcms/ together with payload and keep the versions in sync.

  2. @payloadcms/richtext-slate is not affected by this.

  3. Every single property in the Feature interface which accepts a React component now no longer accepts a React component, but a function which imports a React component instead. This is done to ensure no unnecessary client-only code is leaked to the server when importing Features on a server.
    Here's an example migration:

Old:

import { BlockIcon } from '../../lexical/ui/icons/Block'
...
Icon: BlockIcon,

New:

// import { BlockIcon } from '../../lexical/ui/icons/Block' // <= Remove this import
...
Icon: () =>
  // @ts-expect-error
  import('../../lexical/ui/icons/Block').then((module) => module.BlockIcon),

Or alternatively, if you're using default exports instead of named exports:

// import BlockIcon from '../../lexical/ui/icons/Block' // <= Remove this import
...
Icon: () =>
  // @ts-expect-error
  import('../../lexical/ui/icons/Block'),
  1. The types for SanitizedEditorConfig and EditorConfig have changed. Their respective lexical property no longer expects the LexicalEditorConfig. It now expects a function returning the LexicalEditorConfig. You will have to adjust this if you adjusted that property anywhere, e.g. when initializing the lexical field editor property, or when initializing a new headless editor.

  2. The following exports are now exported from the @payloadcms/richtext-lexical/components subpath exports instead of @payloadcms/richtext-lexical:

  • ToolbarButton
  • ToolbarDropdown
  • RichTextCell
  • RichTextField
  • defaultEditorLexicalConfig

You will have to adjust your imports, only if you import any of those properties in your project.

Statistics:

File Changed300
Line Additions22,145
Line Deletions9,267
Line Changes31,412
Total Commits191

User Affected:

  • Need to update code if using TreeviewFeature (now TreeViewFeature) in Lexical editor
  • Must adjust frontend code if reading link node data from Lexical editor
  • Required to update both Payload and @payloadcms/richtext-lexical packages together
  • Benefit from improved field handling and relationship querying optimizations
  • Can use new context property in auth and globals local API

Contributors:

jacobsfletchjmikrutjessrynkarAlessioGrkalon-robsonrsissondenolfedotelliedragos199993JarrodMFleschDanRibbensPatrikKozakdependabot[bot]LivogSajarin-Mr1tsuu