TL;DR
Payload CMS v0.6.0: Auto-labeling fields and improved relationship handling
This release introduces automatic field labeling, eliminating the need to manually specify labels for fields, blocks, and globals. It also significantly improves relationship handling with better search functionality and dynamic population of rich text relationships. The update includes enhanced error handling for uniqueness constraints and several UI improvements for the rich text editor. Default access control now requires users to be logged in, improving security out of the box.
Highlight of the Release
- Automatic field labeling when labels are omitted
- Dynamic population of rich text relationships with configurable depth
- Improved uniqueness error handling
- Default access control now requires users to be logged in
- Better relationship field searching
Migration Guide
Migrating to v0.6.0
Field Labels
You can now remove explicit labels from your field configurations as Payload will automatically generate them. For example:
// Before
{
name: 'title',
type: 'text',
label: 'Title',
}
// After
{
name: 'title',
type: 'text',
// label is automatically generated as "Title"
}
Access Control
The default access control now requires users to be logged in. If you were relying on the previous default behavior, you'll need to explicitly set your access control:
{
access: {
read: () => true, // Allow public read access
}
}
Rich Text Relationships
If you're using rich text fields with relationships, you can now specify a depth parameter for GraphQL queries to control how deeply nested relationships are populated:
{
posts {
content(depth: 2) {
# Rich text content with relationships populated to depth 2
}
}
}
Upgrade Recommendations
This release includes significant improvements to field labeling, relationship handling, and security defaults, making it a recommended upgrade for all Payload users.
To upgrade:
- Update your package.json:
"payload": "^0.6.0"
- Run
npm install or yarn
- Review your access control settings if you were relying on the previous default behavior
- Consider removing explicit field labels to take advantage of the new auto-labeling feature
- Test your application thoroughly, especially if you're using relationship fields or rich text editors
The changes in this release are mostly non-breaking, but the new default access control requiring login may affect applications that relied on the previous default behavior.
Bug Fixes
Fixed Issues
- Fixed an issue where the rich text element wasn't clearing properly on enter and improved focus handling when clicking toolbar buttons
- Ensured API keys are properly populated in the admin interface
- Fixed a bug where first options were being loaded multiple times
- Resolved issues with searching on relationship fields to properly fetch results
- Set upload
useAsTitle to filename by default for better usability
- Fixed handling of falsey column labels and array labels
- Corrected object type naming in the system
New Features
Auto-labeling Fields
Fields, blocks, and globals now automatically generate labels when they are omitted, reducing boilerplate code and improving developer experience. This feature intelligently converts camelCase or snake_case field names into proper labels.
Dynamic Rich Text Relationships
Rich text fields now support dynamic population of relationships, allowing for more complex content structures. The new depth parameter in GraphQL rich text fields gives developers control over how deeply nested relationships are populated.
Improved Uniqueness Error Handling
Better error handling for uniqueness constraints provides clearer feedback when duplicate entries are detected, improving both developer and user experience.
Default Access Control
Access control now defaults to requiring users to be logged in, enhancing security out of the box for Payload applications.
Rich Text UI Improvements
The rich text editor received several UI enhancements, including improved margins and better toolbar button interactions.
Security Updates
Security Improvements
- Default access control now requires users to be logged in, providing better security by default
- Improved API key handling in the admin interface
Performance Improvements
Performance Enhancements
- More efficient relationship field handling with improved search functionality
- Optimized loading of options to ensure they're only loaded once
- More efficient handling of rich text relationships with configurable depth parameter to control data loading
Impact Summary
Payload CMS v0.6.0 represents a significant quality-of-life improvement for developers with the introduction of automatic field labeling, which reduces boilerplate code and improves maintainability. The enhanced relationship handling, particularly in rich text fields, enables more complex content structures with better performance.
The improved error handling for uniqueness constraints and UI enhancements to the rich text editor provide a better experience for both developers and content editors. The default security improvement requiring users to be logged in aligns with best practices for CMS security.
This release balances new features with important bug fixes and performance improvements, making it a well-rounded update that benefits all types of Payload users. The changes are mostly additive and non-breaking, though the new default access control behavior may require attention during upgrades.
Full Release Notes
0.6.0 (2021-04-19)
Bug Fixes
- clears richtext element on enter, refocuses on toolbar button click (4b19795)
- ensures api keys are properly populated in admin (4359a70)
- ensures first options are loaded only once (75a5b04)
- searching on relationship fields properly fetches results (b86c3da)
- upload useAsTitle set to filename by default (7db23f8)
Features
- autolabel fields when label is omitted (#42) (b383eb6)
- dynamically populates richtext relationships (3530424)
- improve uniqueness error handling (21b2bd4)
- improves margins in rich text (20d7a01)