TL;DR
Payload CMS v2.29.0 Release
This release introduces a new configuration option to disable JOI validation and fixes several important bugs in the PostgreSQL database adapter, including issues with localized arrays, relationship field queries, and table name sanitization. It also improves query handling for empty strings in exists queries and updates dependencies.
Highlight of the Release
- New configuration option to disable JOI validation for performance optimization
- Fixed PostgreSQL issues with localized items in arrays with versions
- Improved query handling for empty strings in
exists queries
- Fixed PostgreSQL querying on arrays within relationship fields
- Better sanitization of tab/group paths for PostgreSQL table names
Migration Guide
This release doesn't require any specific migration steps. All changes are backward compatible.
If you choose to disable JOI validation using the new configuration option, make sure to thoroughly test your application first, as this will bypass schema validation that might catch potential issues with your data.
Upgrade Recommendations
This release is recommended for all users, especially those using PostgreSQL as their database adapter or those looking for performance optimizations.
To upgrade:
npm install [email protected]
# or
yarn add [email protected]
# or
pnpm add [email protected]
Note that this release includes an update to Express 4.21.0. While this shouldn't cause any issues, it's always a good practice to test thoroughly after upgrading.
Bug Fixes
PostgreSQL Database Adapter Fixes
Localized Items in Arrays with Versions
Fixed an issue where trying to append a new item to an array containing another array with localized items and enabled versions would lead to a unique _locale and _parent_id error. This fix ensures proper handling of nested arrays with localized content when versioning is enabled.
Array Querying Within Relationship Fields
Resolved an issue with querying on arrays within relationship fields in PostgreSQL. This fix ensures that complex queries involving arrays nested within relationships work correctly.
Tab/Group Path Sanitization
Fixed an issue where tab and group paths were not properly sanitized for PostgreSQL table names, which could cause errors when using certain characters in field paths.
Query Handling Improvements
Empty String Handling in exists Queries
Fixed inconsistent behavior by treating empty strings as null/undefined for exists queries. This ensures that queries like { field: { exists: false } } will correctly match documents where the field is an empty string, null, or undefined.
New Features
Disable JOI Validation
A new configuration option joiValidation: boolean has been added to the Payload config. When set to false, it bypasses JOI validation for all collections, globals, fields, etc. This feature can significantly improve performance in production environments where validation has already been thoroughly tested.
// In your payload.config.ts
export default buildConfig({
// ...other config
joiValidation: false, // Disable JOI validation
})
This option defaults to true to maintain backward compatibility.
Security Updates
No specific security fixes were included in this release.
Performance Improvements
Performance Optimizations
The new joiValidation configuration option provides a significant performance improvement opportunity. By disabling JOI validation in production environments (after thorough testing), applications can reduce CPU usage and response times, especially for complex data structures with many fields and validations.
This is particularly beneficial for high-traffic applications or those running on resource-constrained environments.
Impact Summary
Payload CMS v2.29.0 brings important improvements for both developers and content editors. The ability to disable JOI validation offers a significant performance optimization opportunity for production environments.
PostgreSQL users will benefit from several critical bug fixes that resolve issues with localized content in nested arrays, relationship field queries, and table name sanitization. These fixes ensure more reliable operation when working with complex data structures and international content.
The improvement to exists query handling ensures more consistent behavior when filtering content, treating empty strings the same as null or undefined values.
Overall, this release enhances stability and performance while maintaining backward compatibility, making it a recommended upgrade for all Payload CMS users.
Full Release Notes
2.29.0 (2024-09-25)
Features
Bug Fixes
- treat empty strings as null / undefined for
exists queries (#8336) (31d0b30), closes #7714
- db-postgres: localized items in arrays with versions (#8334) (c86526b)
- db-postgres: querying on array within a relationship field (#8153) (170ea5b)
- db-postgres: sanitize tab/group path for table name (#8010) (ba7a043)