Home

>

Tools

>

Payload CMS

>

Releases

>

3.0.0-beta.32

Payload CMS Release: 3.0.0-beta.32

Pre Release

Tag Name: 3.0.0-beta.32

Release Date: 5/14/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 3.0.0-beta.32 introduces significant enhancements to the rich text editor, improves server-side component props, and consolidates admin routes configuration. This release includes breaking changes that affect custom React Server Components and admin route configuration, requiring migration steps for existing implementations. The update also fixes GraphQL issues with upload relations and draft values.

Highlight of the Release

    • Added rootFeatures prop to Lexical rich text editor for enhanced customization
    • Improved server-side component props with additional context like i18n, locale, and user data
    • Consolidated admin route configuration with new admin.routes structure
    • Fixed GraphQL issues with upload relations and draft values

Migration Guide

Migrating Server Components

If you use any of the following components in your project, you'll need to update them to accept additional server-only props:

  • Account view
  • Default Dashboard view
  • DefaultTemplate
  • WithServerSideProps
  • RenderCustomComponent (optional)
  • Logo

Previously, these components only required the payload prop. Now they need additional server-side props as detailed in the release notes.

If you're using an HOC as a custom component that passes props to client components, you'll need to either:

  • Use the withMergedProps helper to automatically filter out server-only props
  • Mark your HOC with 'use client' directive

Migrating Admin Routes Configuration

To migrate from the old route configuration to the new structure:

Old way:

// payload.config.ts
{ 
  // ...
  admin: {
    logoutRoute: '/custom-logout',
    inactivityRoute: '/custom-inactivity'
  }
}

New way:

// payload.config.ts
{
  // ...
  admin: {
    routes: {
      logout: '/custom-logout',
      inactivity: '/custom-inactivity'
    }
  }
}

Upgrade Recommendations

For developers using PayloadCMS in beta environments or projects that can tolerate breaking changes:

  • Upgrade to 3.0.0-beta.32 to take advantage of the new features and bug fixes
  • Follow the migration guide to update your custom components and admin route configurations

For production environments:

  • Test the upgrade thoroughly in a staging environment before deploying
  • Pay special attention to custom React Server Components and admin route configurations
  • If you use GraphQL with upload relations, verify that draft values are handled correctly after the upgrade

This release contains breaking changes, so be prepared to make the necessary code adjustments as outlined in the migration guide.

Bug Fixes

GraphQL Upload Relations Fix

Fixed an issue in GraphQL where upload relations weren't correctly handling draft values. This ensures that when querying related uploads through GraphQL, the system properly respects the draft status of those uploads, providing more consistent and expected results.

New Features

Enhanced Rich Text Editor

The Lexical rich text editor now supports a new rootFeatures prop, allowing for more granular customization of the editor's capabilities at the root level.

Improved Server Component Props

React Server Components now receive a more comprehensive set of server-side props:

  • For components rendered outside buildComponentMap: i18n, locale, params, payload, permissions, searchParams, and user
  • For components within buildComponentMap: i18n and payload

This provides more context and data to server components, enabling more powerful and flexible implementations.

Consolidated Admin Routes Configuration

Admin routes configuration has been streamlined with a new admin.routes object that consolidates previously separate route configurations into a single, more organized structure.

Security Updates

No security fixes were mentioned in this release.

Performance Improvements

No specific performance improvements were highlighted in this release. The changes are primarily focused on feature enhancements, bug fixes, and structural improvements to the codebase.

Impact Summary

This release introduces significant improvements to PayloadCMS's developer experience and component architecture. The enhanced server component props system provides more context and data to custom components, enabling more powerful implementations but requiring updates to existing code. The consolidated admin routes configuration simplifies the API but requires migration from the previous structure.

The addition of the rootFeatures prop to the Lexical rich text editor enhances customization options for content editing experiences. Meanwhile, the GraphQL fix for upload relations ensures more reliable handling of media assets in draft states.

Overall, this beta release continues to refine the architecture and developer experience of PayloadCMS 3.0, though it does require some migration effort due to the breaking changes.

Full Release Notes

3.0.0-beta.32 (2024-05-14)

Features

  • richtext-lexical: add rootFeatures prop to lexicalEditor (#6360) (c8a1cca)
  • add missing server-only props to custom RSCs, improve req.user type, clean-up ui imports (#6355) (79f4907)
  • consolidates admin.logoutRoute and admin.inactivityRoute into admin.routes (#6354) (6a0fffe)

Bug Fixes

  • graphql: threads through correct draft value for upload relations (#6235) (6e116a7)

BREAKING CHANGES

  • add missing server-only props to custom RSCs, improve req.user type, clean-up ui imports (#6355) (79f4907)

Previously, we were only passing payload to RSCs. Now, we are passing the following props for component rendered outside buildComponentMap:

  • i18n,
  • locale,
  • params,
  • payload,
  • permissions,
  • searchParams,
  • user

And the following props for components rendered within buildComponentMap:

  • i18n,
  • payload,

Breaking:

if you use the following components in your own project, these now require aforementioned additional, server-only props, instead of just the payload prop:

  • Account view
  • Default Dashboard view
  • DefaultTemplate
  • WithServerSideProps
  • RenderCustomComponent (optional)
  • Logo

Additionally, if you were using an HOC as a custom component, and the HOC passed props to the client component, you now have to filter out the additional server-only props we provide. You can use our withMergedProps helper, which filters them automatically, >or mark your HOC with 'use client'.

  • consolidates admin.logoutRoute and admin.inactivityRoute into admin.routes (#6354) (6a0fffe)

The admin.logoutRoute and admin.inactivityRoute properties have been consolidated into a single admin.routes property. To migrate, simply move those two keys as follows:

Old way:

// payload.config.ts
{ 
  // ...
  admin: {
    logoutRoute: '/custom-logout',
    inactivityRoute: '/custom-inactivity'
  }
}

New way:

// payload.config.ts
{
  // ...
  admin: {
    routes: {
      logout: '/custom-logout',
      inactivity: '/custom-inactivity'
    }
  }
}

Contributors

Statistics:

File Changed3
Line Additions3,357
Line Deletions2,935
Line Changes6,292
Total Commits1

User Affected:

  • Need to update custom React Server Components to accept additional server-only props
  • Must migrate from `admin.logoutRoute` and `admin.inactivityRoute` to the new consolidated `admin.routes` structure
  • Can now use the new `rootFeatures` prop in Lexical rich text editor for more customization
  • Benefit from improved GraphQL handling of upload relations with draft values

Contributors:

jacobsfletch