Payload CMS Release: 3.2.0

Tag Name: v3.2.0

Release Date: 11/27/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

Payload CMS 3.2.0: Performance Boost and Enhanced Features

Payload CMS 3.2.0 brings significant performance improvements with up to 100x faster page navigation, new features like cross-locale data copying, and a JSX converter for Lexical rich text. The update also includes on-demand collection reindexing for search, improved RTL support, and various bug fixes that enhance the overall stability and user experience.

Highlight of the Release

    • Up to 100x faster page navigation with optimized client configuration
    • New ability to copy data across locales at document level
    • On-demand collection reindexing for search functionality
    • Lexical to JSX converter for rich text frontend rendering
    • Improved RTL language support

Migration Guide

Migrating from react-animate-height

If you've been using react-animate-height in your custom components, you should consider migrating to the native CSS approach used in this release:

/* Add this to your CSS */
.your-animated-element {
  interpolate-size: allow-keywords;
  transition: height 0.2s ease-out;
}
// Replace this:
import AnimateHeight from 'react-animate-height';
<AnimateHeight height={isOpen ? 'auto' : 0}>
  {content}
</AnimateHeight>

// With this:
<div style={{ height: isOpen ? 'auto' : '0px' }}>
  {content}
</div>

Note that the CSS property interpolate-size: allow-keywords; is experimental, but the release includes a patch for browsers without native support.

Using the New Lexical to JSX Converter

To use the new Lexical to JSX converter in your frontend:

  1. Import the necessary components:
import { RichText } from '@payloadcms/richtext-lexical/react'
  1. Define your custom converters:
const jsxConverters = ({ defaultConverters }) => ({
  ...defaultConverters,
  // Add your custom converters here
})
  1. Use the RichText component:
<RichText
  converters={jsxConverters}
  data={yourLexicalData}
/>

Upgrade Recommendations

This release brings significant performance improvements and useful new features without introducing breaking changes, making it a recommended upgrade for all Payload CMS users.

Priority: Medium-High

Who should upgrade immediately:

  • Projects with large configurations experiencing slow admin panel navigation
  • Multi-language sites that would benefit from the cross-locale content copying feature
  • Projects using the search plugin that need to reindex collections
  • Applications with RTL language support

Upgrade steps:

  1. Update your Payload CMS dependency to version 3.2.0:

    npm install [email protected]
    # or
    yarn add [email protected]
    
  2. If you're using any of the plugins that received updates (form-builder, search, seo), update those as well to their latest compatible versions.

  3. Test your application thoroughly, especially if you have custom components that might be affected by the changes to animation handling or rich text formatting.

Bug Fixes

UI and Accessibility Fixes

  • Fixed localizer positioning in RTL mode, properly aligning it to the left side of the screen for RTL languages
  • Removed overflow hidden from app-header wrappers, fixing issues with popout elements like dropdowns and menus
  • Fixed SEO plugin fields not being properly disabled when a user lacks permissions

Rich Text Editor Fixes

  • Prevented the use of text formats (bold, italic, etc.) when their features were not enabled in the editor configuration
  • Fixed issues with text formatting being applied via keyboard shortcuts or paste operations even when the formatting features were disabled

Query and Access Control Fixes

  • Fixed validation of where query paths from access results, resolving issues with findByID operations
  • Properly threaded field permissions through version diffs, fixing display issues for iterable fields like blocks
  • Added support for overriding entity visibility within drawers, allowing hidden entities to be rendered in document and list drawers
  • Made emails non-unique when email login is disabled, providing more flexibility in user management

Other Fixes

  • Fixed form builder plugin to allow overrides to payment fields group
  • Fixed website template issues with loading lazy on medium hero components
  • Corrected various TypeScript and null check issues

New Features

Copy Data Across Locales

A powerful new feature allows copying content from one locale to another at the document level. Content editors can now select origin and destination locales, with options to either overwrite existing data or only copy into empty fields in the destination locale.

On-Demand Collection Reindexing for Search

The search plugin now supports reindexing entire searchable collections on demand. This is particularly useful when adding the search plugin to an existing project with documents already in place. Users can select specific collections to reindex or choose to reindex all collections at once.

Lexical to JSX Converter

A new converter allows transforming Lexical rich text content into JSX for frontend rendering. This makes it easier to customize the display of rich text content in React applications:

import { RichText } from '@payloadcms/richtext-lexical/react'

const jsxConverters = ({ defaultConverters }) => ({
  ...defaultConverters,
  blocks: {
    myTextBlock: ({ node }) => <div style={{ backgroundColor: 'red' }}>{node.fields.text}</div>,
  },
})

export const MyComponent = ({ lexicalContent }) => {
  return (
    <RichText
      converters={jsxConverters}
      data={data.lexicalWithBlocks}
    />
  )
}

Exported hasText Helper

The hasText helper method has been extracted and exported from richTextValidateHOC, making it available for frontend serialization. This is useful for checking whether text content exists before rendering elements like captions.

Native CSS Animation

Deprecated the react-animate-height dependency in favor of native CSS animations using the interpolate-size: allow-keywords; property. This reduces bundle size while maintaining compatibility with the previous API.

Security Updates

No specific security fixes were mentioned in this release.

Performance Improvements

Dramatically Faster Page Navigation

This release brings significant performance improvements to the admin panel, with page navigation speed increasing by up to 100x in some cases. The improvements come from several optimizations:

  1. Faster Client Configuration: The createClientConfig function has been optimized, reducing execution time from seconds to milliseconds for large configurations. In test configurations with many fields and collections, execution time went from 4 seconds to just 50ms.

  2. Proper Caching: Client configuration is now properly cached in both development and production environments, eliminating redundant processing between page navigations.

  3. Optimized Version Fetching: Version queries have been optimized to use the select API for limiting queried fields and to skip database queries entirely when a document is published.

  4. Faster Lexical Initialization: Removed unnecessary deep copying of Lexical objects, reducing memory usage and improving load times. The Lexical default config sanitization now happens less frequently.

These improvements are particularly noticeable for large configurations with many rich text fields, as the system no longer repeatedly deep-copies large editor configurations.

Impact Summary

Payload CMS 3.2.0 delivers a substantial performance boost to the admin panel with up to 100x faster page navigation through optimized client configuration and caching. Content editors gain powerful new tools like cross-locale content copying and on-demand collection reindexing for search functionality. Developers benefit from new features like the Lexical to JSX converter and the exported hasText helper for rich text validation.

The release also addresses several UI and accessibility improvements, including better RTL language support and fixes for dropdown menus in the app header. The migration from react-animate-height to native CSS animations reduces bundle size while maintaining compatibility.

Overall, this is a significant quality-of-life update that makes Payload CMS faster and more feature-rich without introducing breaking changes, making it a recommended upgrade for all users.

Full Release Notes

v3.2.0 (2024-11-27)

šŸš€ Features

  • adds ability to copy data from across locales (#8203) (601759d)
  • deprecates react-animate-height in favor of native css (#9456) (0757e06)
  • plugin-search: added support for reindexing collections on demand (#9391) (defa13e)
  • richtext-lexical: export hasText helper (#9484) (21db058)
  • richtext-lexical: lexical => JSX converter (#8795) (bffd98f)

⚔ Performance

  • faster page navigation by speeding up createClientConfig, speed up version fetching, speed up lexical init. Up to 100x faster (#9457) (fd0ff51)

šŸ› Bug Fixes

  • utilizes override access false (#9550) (2248be4)
  • overrides entity visibility within drawers (#9546) (5d18a52)
  • allows for emails to be non unique when allowEmailLogin is false (#9541) (67a9d66)
  • skip validation of where query paths from access result (#9349) (a9f511d)
  • corrects localizer positioning in RTL mode (#9494) (910b681)
  • next: properly threads field permissions through versions diff (#9543) (f19053e)
  • plugin-form-builder: allow overrides to the payment fields group (#9522) (71c2f63)
  • plugin-seo: enforce readonly on the client (#9536) (44c0cdb)
  • richtext-lexical: prevent use of text formats whose features were not enabled (#9507) (90f893a)
  • templates: website priority with loading lazy on medium hero error (#9537) (dac42ff)
  • ui: remove overflow hidden from app-header wrappers since it breaks any popout elements (#9525) (82145f7)

šŸ¤ Contributors

Statistics:

File Changed300
Line Additions6,121
Line Deletions27,152
Line Changes33,273
Total Commits26

User Affected:

  • Benefit from significantly faster page navigation with optimized client config generation
  • Can now use the new Lexical to JSX converter for frontend rendering
  • Have access to the new `hasText` helper for rich text validation
  • No longer need to rely on the `react-animate-height` dependency

Contributors:

jacobsfletchpaulpopusPatrikKozakakhrarovsaiddenolfeHarleySalasJarrodMFleschr1tsuuAlessioGrjessrynkarGermanJablo58bits