TL;DR
PayloadCMS v3.0.0-beta.44 introduces automatic TypeScript type generation by default, a significant breaking change that improves developer experience. This release also includes important bug fixes for draft validations in globals, checkbox label functionality, tab paths in nested fields, and GraphQL JSON type exports. UI improvements remove complex fields from sort options, and build process enhancements improve compatibility with Turborepo.
Highlight of the Release
- Automatic TypeScript type generation enabled by default (breaking change)
- Fixed draft validations for global content
- Improved checkbox functionality with proper label toggling
- Removed complex fields (arrays, blocks, groups) from sort options
- Re-exported GraphQL JSON types for external use
- Fixed tab paths when nested within row-like fields
- Enhanced build process compatibility with Turborepo
Migration Guide
Migrating to v3.0.0-beta.44
Handling Automatic Type Generation
The most significant change in this release is that TypeScript types are now automatically generated by default. If you prefer to maintain manual control over type generation, you'll need to explicitly opt out:
buildConfig({
// Rest of config
typescript: {
autoGenerate: false
},
})
For Projects Using GraphQL JSON Types
If your project uses GraphQL JSON types, you can now import them directly from the package:
import { GraphQLJSON, GraphQLJSONObject } from '@payloadcms/graphql/types'
For Projects with Complex Nested Tab Structures
If you have complex nested tab structures, this release fixes path generation issues. No specific migration steps are needed, but you may notice improved behavior in your admin UI.
For Projects Using Turborepo
If you've been experiencing issues with type generation in Turborepo environments, this release should resolve those problems without requiring any specific migration steps.
Upgrade Recommendations
Recommendation Level: Moderate Priority
This release contains a breaking change related to TypeScript type generation, so developers should plan their upgrade carefully, especially for TypeScript projects.
For TypeScript Projects:
- Review the new automatic type generation behavior and decide if you want to keep it or opt out
- Test thoroughly after upgrading to ensure type generation works as expected
- If using Turborepo, this upgrade is particularly beneficial as it fixes compatibility issues
For Non-TypeScript Projects:
- This upgrade is recommended for the UI improvements and bug fixes
- The breaking change regarding TypeScript type generation won't affect your project
Upgrade Steps:
- Update your dependency:
npm install @payloadcms/[email protected] or yarn add @payloadcms/[email protected]
- If you prefer to opt out of automatic type generation, add the configuration as described in the migration guide
- Test your application thoroughly, particularly focusing on forms with checkboxes, global drafts, and nested tab structures
Bug Fixes
UI Improvements
- Checkbox Label Functionality: Fixed an issue where checkbox labels weren't properly toggling the associated checkbox by setting
htmlFor attribute by default (#6684)
- Sort Options Cleanup: Removed complex fields (
array, blocks, and group) from sort options, providing a cleaner and more intuitive sorting interface (#6576)
- Tab Path Correction: Fixed an issue with tab paths when nested within other row-like fields, addressing all three possible scenarios: when a path is provided with a named tab, when no path is provided but the tab is named, and when neither a path nor a tab name are provided (#6712)
Content Management Fixes
- Global Draft Validations: Extended draft validation to work with globals and fixed a bug where autosave was not saving properly after the first autosave (#6709)
- GraphQL JSON Types: Re-exported
GraphQLJSON and GraphQLJSONObject from @payloadcms/graphql/types for external use, fixing issue #6683 (#6711)
Build Process Improvements
- Turborepo Compatibility: Fixed automatic type generation to work properly with Turborepo by running type generation in a child process outside of Turborepo/webpack (#6714)
- Cross-Platform Build Commands: Improved clean commands to work properly on Windows and added pretty summary output (#6685)
New Features
Automatic TypeScript Type Generation
TypeScript types are now automatically generated by default, significantly improving developer experience by reducing manual configuration. This is a breaking change that affects all TypeScript projects.
To opt out of this behavior, you can configure your project as follows:
buildConfig({
// Rest of config
typescript: {
autoGenerate: false
},
})
This feature streamlines development by ensuring your types are always up-to-date with your schema changes.
Security Updates
No specific security fixes were included in this release.
Performance Improvements
Build and Development Performance
-
Improved Build Process: Enhanced clean commands now work better on Windows systems and provide a pretty summary output, making the development process more efficient (#6685)
-
Turborepo Compatibility: Fixed type generation to work properly in Turborepo environments by running the generation in a child process outside of Turborepo/webpack, improving build performance and reliability in monorepo setups (#6714)
-
ESM Migration: Migrated @faceless-ui imports to ESM format, contributing to a more modern and potentially more performant codebase (#6681)
Impact Summary
This release introduces a significant change to how TypeScript types are handled in PayloadCMS, with automatic type generation now enabled by default. This is a breaking change that improves developer experience but may require configuration updates for projects that prefer manual type management.
The release also addresses several important UI and functionality issues:
-
Form Interaction Improvements: Fixed checkbox label functionality and corrected tab paths in nested fields, enhancing the admin UI experience.
-
Content Management Enhancements: Extended draft validation to work with globals and fixed autosave functionality, improving content editing reliability.
-
Developer Experience Upgrades: Re-exported GraphQL JSON types for external use, improved build commands for Windows compatibility, and fixed type generation in Turborepo environments.
-
UI Refinements: Removed complex fields from sort options, providing a cleaner and more intuitive sorting interface.
Overall, this release balances introducing a significant developer experience improvement (auto type generation) with fixing several pain points reported by the community. The breaking change is well-documented with a clear opt-out path, making this a valuable upgrade for most PayloadCMS projects.
Full Release Notes
Features
Bug Fixes
- get auto type-gen to work on turbo, by running type gen in a child process outside turbo/webpack (#6714) (7b7dc71)
- corrects tab paths when nested within other row like fields (#6712) (ba513d5)
- re-exports graphql json types for external use (#6711) (a26d031)
- ui: removes
array & blocks & group fields from sort (#6576) (9f52562)
- global draft validations (#6709) (45e8683)
- ui: set checkbox htmlFor by default, fixing some checkbox labels not toggling the checkbox (#6684) (ac34380)
BREAKING CHANGES
Types are now auto-generated by default.
You can opt-out of this behavior by setting:
buildConfig({
// Rest of config
typescript: {
autoGenerate: false
},
})
Contributors