Payload CMS Release: 2.30.0

Tag Name: v2.30.0

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

PayloadCMS v2.30.0 Release

This minor release exports the toast function from react-toastify directly in PayloadCMS, making it easier for developers to use toast notifications in custom components without module mismatch issues. Now developers can simply import toast from payload/components/elements instead of having to import it directly from react-toastify.

Highlight of the Release

    • Export of toast function from react-toastify directly in PayloadCMS
    • Simplified import path: import { toast } from 'payload/components/elements'
    • Prevention of module mismatch issues when using toast notifications

Migration Guide

Migration to Using Exported Toast

While no migration is required, developers are encouraged to update their code to use the newly exported toast function:

// Before
import { toast } from 'react-toastify'

// After
import { toast } from 'payload/components/elements'

This change is backward compatible, so existing code will continue to work, but using the PayloadCMS export will help prevent potential module mismatch issues.

Upgrade Recommendations

This is a minor release with a helpful developer experience improvement. It's recommended to upgrade if you're using toast notifications in your custom components, as it will help prevent potential module mismatch issues.

To upgrade:

npm install [email protected]
# or
yarn add [email protected]
# or
pnpm add [email protected]

After upgrading, consider updating your imports to use the newly exported toast function from payload/components/elements.

Bug Fixes

No specific bug fixes were included in this release.

New Features

Toast Function Export

PayloadCMS now exports the toast function from react-toastify directly, allowing developers to use it in their custom components without worrying about module mismatches. This enhancement simplifies the developer experience by providing a consistent way to access toast notifications.

// You can now use this import
import { toast } from 'payload/components/elements'

// Instead of importing directly from react-toastify
// import { toast } from 'react-toastify'

This change ensures that the toast function used in your components is the same instance that PayloadCMS uses internally, preventing potential compatibility issues.

Security Updates

No security fixes were included in this release.

Performance Improvements

No specific performance improvements were included in this release.

Impact Summary

This release has a low impact on existing projects as it only adds a new export without changing any existing functionality. The primary benefit is for developers who use toast notifications in their custom components, as they can now import the toast function directly from PayloadCMS instead of react-toastify, avoiding potential module mismatch issues.

The change is particularly valuable in complex projects where multiple versions of react-toastify might be present, ensuring that the toast notifications work consistently throughout the application. This is a quality-of-life improvement that makes PayloadCMS more developer-friendly and reduces potential integration issues.

Full Release Notes

Statistics:

File Changed5
Line Additions11
Line Deletions4
Line Changes15
Total Commits4

User Affected:

  • Can now import `toast` directly from `payload/components/elements`
  • Avoid potential module mismatch issues when using toast notifications in custom components
  • Simplified integration of toast notifications in PayloadCMS projects

Contributors:

denolfepaulpopus