Home

>

Tools

>

Payload CMS

>

Releases

>

3.0.0-beta.78

Payload CMS Release: 3.0.0-beta.78

Pre Release

Tag Name: v3.0.0-beta.78

Release Date: 8/13/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.78 brings several new features and bug fixes to enhance developer experience and UI functionality. Key improvements include custom image size file names, enhanced form builder plugin capabilities, redirect type options, and fixes for authentication issues. The update also improves UI styling for mobile devices and resolves several critical bugs related to field permissions, filtering, and configuration handling.

Highlight of the Release

    • Custom image size file names for more flexibility in asset management
    • Enhanced form builder plugin with improved typing and access to beforeChange parameters
    • Support for redirect types in the redirects plugin
    • Fixed authentication issues with local strategy and autoLogin
    • Improved mobile styling and UI enhancements
    • Fixed field permissions updating when locale changes

Migration Guide

API Key Field Customization

If you want to override the apiKey field with access control, you can now add this field to your auth collection:

{
  name: 'apiKey',
  type: 'text',
  access: {
    update: ({ req }) => req.user.role === 'admin',
  }
}

Form Builder Plugin Changes

If you're using the Form Builder Plugin and have implemented the beforeEmail hook, you can now take advantage of improved typing and access to the full beforeChange parameters:

import type { BeforeEmail } from '@payloadcms/plugin-form-builder'
import type {FormSubmission} from '@payload-types'

const beforeEmail: BeforeEmail<FormSubmission> = (emailsToSend, beforeChangeParams) => {
  // Your implementation with full access to beforeChangeParams
  return emailsToSend;
}

Redirects Plugin Updates

If you're using the Redirects Plugin and want to specify redirect types, update your configuration:

redirectTypes: ['301', '302'],
redirectTypeFieldOverride: {
  label: 'Custom Redirect Type Label',
},

Upgrade Recommendations

This beta release includes several important bug fixes and feature enhancements that improve the developer experience and user interface. If you're already using the v3.0.0 beta series, upgrading to beta.78 is recommended to benefit from these improvements.

For developers experiencing any of the specific issues addressed in this release (such as authentication problems, field permission issues, or UI glitches), upgrading is particularly important.

As this is still a beta release, be sure to test thoroughly in a non-production environment before deploying to production systems.

Bug Fixes

Authentication Fixes

  • Fixed local strategy user lookup when using loginWithUsername
  • Fixed autoLogin not working if an old, invalid token is present

UI Fixes

  • Fixed apiKey field not being customizable and field access control not being updated with correct data
  • Fixed field permissions not being correctly updated when locale changes
  • Fixed rendering of singular label for ArrayCell when length is 1
  • Added editDepth to account view to prevent redirects from modals
  • Set correct step nav path to Account on account page
  • Improved mobile styling of Payload admin UI
  • Reduced font size on dashboard cards
  • Improved block/collapsible/array field styling

Data Handling Fixes

  • Fixed filtering by polymorphic relationships with drafts enabled
  • Fixed config deepmerge issue that was causing an infinite loop in config sanitization

New Features

Custom Image Size File Names

You can now specify custom file names for image sizes, providing more flexibility in how your resized images are stored and referenced:

{
  name: 'thumbnail',
  width: 400,
  height: 300,
  generateImageName: ({ height, sizeName, extension, width }) => {
    return `custom-${sizeName}-${height}-${width}.${extension}`
  },
}

Enhanced Form Builder Plugin

The Form Builder Plugin's beforeEmail hook now takes a generic for your generated types and provides access to the full hook parameters:

import type { BeforeEmail } from '@payloadcms/plugin-form-builder'
// Your generated FormSubmission type
import type {FormSubmission} from '@payload-types'

// Pass it through and 'data' or 'originalDoc' will now be typed
const beforeEmail: BeforeEmail<FormSubmission> = (emailsToSend, beforeChangeParams) => {
  // modify the emails in any way before they are sent
  return emails.map((email) => ({
    ...email,
    html: email.html, // transform the html in any way you'd like (maybe wrap it in an html template?)
  }))
}

Redirect Types in Redirects Plugin

You can now add redirect types to your redirects collection:

// Supported types
redirectTypes: ['301', '302'],

// Override the select field
redirectTypeFieldOverride: {
  label: 'Redirect Type (Overridden)',
},

Class Names for List and Edit Views

Added class names to list and edit views for better styling customization.

Indented Migration SQL

Migration SQL is now properly indented for improved readability and maintainability.

Security Updates

No specific security fixes were mentioned in this release.

Performance Improvements

UI Performance Improvements

The mobile styling improvements and UI adjustments in this release contribute to a more efficient user experience, particularly on smaller screens. The changes to block, collapsible, and array field styling also help streamline the interface for better usability.

Configuration Handling

The fix for the config deepmerge issue resolves an infinite loop problem in configuration sanitization, which improves the startup performance and stability of Payload applications.

Impact Summary

PayloadCMS v3.0.0-beta.78 delivers significant improvements for both developers and content editors. Developers gain more flexibility with custom image size file names, enhanced typing in the form builder plugin, and the ability to customize API key field access control. Content editors benefit from improved mobile styling, fixed field permissions when changing locales, and a more intuitive UI with correct singular/plural labels for array fields.

The release addresses several critical bugs, including authentication issues with local strategy and autoLogin, field permissions not updating correctly with locale changes, and problems with filtering polymorphic relationships when drafts are enabled. The fix for the config deepmerge issue resolves an infinite loop problem that could impact application stability.

Overall, this beta release represents a solid step forward in PayloadCMS's development, with a focus on developer experience, UI improvements, and bug fixes that enhance the platform's reliability and usability.

Full Release Notes

v3.0.0-beta.78 (2024-08-13)

Features

  • add support for custom image size file names (#7634) (56aded8)
  • plugin-form-builder: pass beforeChange params into beforeEmail hook and add types to it (#7626) (78dd6a2)
  • plugin-redirects: added new option for redirect type in the redirects collection (#7625) (5dfcffa)
  • indent migration sql (#7475) (fa3d250)
  • adds classnames to list, edit views (#7596) (c1b0d93)

Bug Fixes

  • config deepmerge, fixes #7580 (#7639) (b33b5f4)
  • autoLogin not working if old, invalid token is present (#7456) (a063b81)
  • payload: filtering by polymorphic relationships with drafts enabled (#7570) (8d12037)
  • ui: render singular label for ArrayCell when length is 1 (#7586) (f88cef5)
  • ui: field permissions not being correctly updated when locale changes (#7611) (4b2a9f7)
  • ui: apiKey field not being customisable and field access control not being updated with correct data (#7591) (69ada97)
  • set correct step nav path to Account on account page (#7599) (81e7355)
  • add editDepth to account view so that it doesn't redirect from modals (#7597) (ce8b95f)
  • corrects local strategy user lookup when using loginWithUsername (#7587) (6227276)

Contributors

Statistics:

File Changed111
Line Additions846
Line Deletions297
Line Changes1,143
Total Commits18

User Affected:

  • Can now create custom file names for image sizes
  • Benefit from improved typing in form builder plugin hooks
  • Can add redirect types to redirects collection
  • Have access to properly indented migration SQL for better readability
  • Can now override the apiKey field with access control

Contributors:

JarrodMFleschjmikrutpaulpopustylandavisDanRibbensdenolfePatrikKozakAlessioGr