Home

>

Tools

>

Payload CMS

>

Releases

>

Release 1.2.0

Payload CMS Release: Release 1.2.0

Tag Name: v1.2.0

Release Date: 11/18/2022

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

Payload CMS v1.2.0: Customizable Headers and Internationalization

This release introduces two major features: customizable header labels for arrays and collapsibles, and internationalization (i18n) support for the admin panel. It also includes important breaking changes to how labels are used for code-based naming in GraphQL and TypeScript interfaces. Developers will need to update their configurations to maintain compatibility with existing code.

Highlight of the Release

    • Added internationalization (i18n) support to the admin panel
    • Introduced customizable header labels for arrays and collapsibles
    • Breaking changes to how labels are used for code-based naming in GraphQL and TypeScript
    • Simplified collapsible label API with improved data passing to components
    • Added comprehensive end-to-end tests for new features

Migration Guide

for v1.2.0

Breaking Changes for Labels

If you previously used labels for collections, globals, or block names, you need to update your configuration to prevent breaking changes to your GraphQL API and TypeScript types:

For Collections:

// Before
{
  slug: 'my-collection',
  label: 'My Collection', // Used for GraphQL and TypeScript naming
  // ...
}

// After
{
  slug: 'my-collection',
  label: 'My Collection', // Now only used for UI display
  graphQL: {
    singularName: 'MyCollection', // For GraphQL schema singular name
    pluralName: 'MyCollections'   // For GraphQL schema plural name
  },
  typescript: {
    interface: 'MyCollection'     // For TypeScript interface generation
  }
  // ...
}

For Globals:

// Before
{
  slug: 'my-global',
  label: 'My Global', // Used for GraphQL and TypeScript naming
  // ...
}

// After
{
  slug: 'my-global',
  label: 'My Global', // Now only used for UI display
  graphQL: {
    name: 'MyGlobal'  // For GraphQL schema name
  },
  typescript: {
    interface: 'MyGlobal' // For TypeScript interface generation
  }
  // ...
}

For Blocks (within Block fields):

// Before
{
  slug: 'my-block',
  label: 'My Block', // Used for GraphQL naming
  // ...
}

// After
{
  slug: 'my-block',
  label: 'My Block', // Now only used for UI display
  graphQL: {
    singularName: 'MyBlock' // For GraphQL schema name
  }
  // ...
}

Updating RowLabel to RowHeader

If you were using custom RowLabel components or functions:

// Before
{
  fields: [
    {
      name: 'items',
      type: 'array',
      admin: {
        components: {
          RowLabel: MyCustomRowLabel
        }
      }
    }
  ]
}

// After
{
  fields: [
    {
      name: 'items',
      type: 'array',
      admin: {
        components: {
          RowHeader: MyCustomRowHeader
        }
      }
    }
  ]
}

Upgrade Recommendations

Priority: High

This release contains breaking changes that require configuration updates if you're using labels for code-based naming. We recommend the following upgrade approach:

  1. Audit Your Code: Identify all places where you rely on GraphQL schema names or TypeScript interfaces generated from labels.

  2. Update Configurations: Add the appropriate graphQL and typescript properties to your collections, globals, and blocks as outlined in the migration guide.

  3. Test Thoroughly: After upgrading, test your GraphQL queries and TypeScript code to ensure everything works as expected.

  4. Explore New Features: Once your application is stable, consider implementing the new customizable headers and i18n support to enhance your admin panel.

For projects with extensive use of labels for code generation, consider allocating dedicated time for this upgrade to ensure all configurations are properly updated.

Bug Fixes

  • Fixed build errors related to component implementations
  • Added optional chaining to components to prevent potential runtime errors
  • Corrected exported custom component types for better TypeScript support
  • Fixed pointer-events styling to ensure the entire label bar is clickable
  • Resolved issues with CollapsibleLabel example types
  • Fixed bug where deleted baseAdminFields caused errors

New Features

Customizable Header Labels

  • Renamed RowLabel to RowHeader for better naming consistency
  • Added ability to customize headers in arrays and collapsibles through:
    • Custom components
    • Functions that return strings or React components
    • Static strings
  • Extended data passed to header functions/components for more context-aware customization
  • Simplified the collapsible label API for easier implementation
  • Added comprehensive documentation and examples

Internationalization (i18n)

  • Added full internationalization support to the admin panel
  • Enables content editors to use the interface in their preferred language
  • Improves accessibility for international teams
  • Implemented with multiple contributors to ensure broad language support

Security Updates

No specific security fixes were mentioned in this release.

Performance Improvements

  • Simplified threaded data for arrays and collapsibles, reducing unnecessary prop passing
  • Streamlined component naming conventions for better debugging and performance profiling
  • Improved component architecture to reduce unnecessary re-renders
  • Optimized clickable areas in the UI for better user interaction

Impact Summary

Payload CMS v1.2.0 introduces significant improvements to the admin UI customization capabilities and internationalization support, but comes with important breaking changes to how labels are used for code generation.

The introduction of customizable header labels for arrays and collapsibles provides developers with much greater flexibility in creating intuitive editing experiences. This feature allows for dynamic headers that can display contextual information based on the content being edited, making complex data structures more manageable for content editors.

The addition of internationalization (i18n) to the admin panel is a major step forward for teams working across multiple languages, making Payload more accessible to non-English speaking users.

However, the breaking changes to how labels are used for code-based naming require careful attention during upgrade. Previously, labels were used to generate GraphQL schema names and TypeScript interfaces, but now these must be explicitly defined using dedicated properties. This change provides more control over code generation but requires configuration updates to maintain compatibility with existing code.

Overall, this release significantly enhances Payload's flexibility and international appeal while requiring some migration effort for existing projects.

Full Release Notes

1.2.0 (2022-11-18)

Bug Fixes

  • build errors (65f0e1c)
  • components optional chaining (d5e725c)
  • corrects exported custom component type (2878b4b)
  • corrects type for CollapsibleLabel example type, adjusts custom component filenames (ccb4231)
  • sets pointer-events to none so the entire label bar is clickable (e458087)

Features

  • add i18n to admin panel (#1326) (bab34d8)
  • adds docs example (2bf0fff)
  • adds playwright tests for array fields (57a8c35)
  • converts rowHeader to collapsibleLabel, extends data passed to functions/components (13ec1e0)
  • customizable header-labels (d45de99)
  • simplifies collapsible label API, adds e2e tests (d9df98f)
  • specifies component names for arrays/collapsibles, simplifies threaded data (b74ea21)

BREAKING CHANGES

  • If you assigned labels to collections, globals or block names, you need to update your config! Your GraphQL schema and generated Typescript interfaces may have changed. Payload no longer uses labels for code based naming. To prevent breaking changes to your GraphQL API and typescript types in your project, you can assign the below properties to match what Payload previously generated for you from labels.

On Collections
Use graphQL.singularName, graphQL.pluralName for GraphQL schema names.
Use typescript.interface for typescript generation name.

On Globals
Use graphQL.name for GraphQL Schema name.
Use typescript.interface for typescript generation name.

On Blocks (within Block fields)
Use graphQL.singularName for graphQL schema names.

Statistics:

File Changed285
Line Additions9,911
Line Deletions3,272
Line Changes13,183
Total Commits27

User Affected:

  • Need to update configurations if using labels for collections, globals, or blocks due to breaking changes
  • Can now create customized header labels for arrays and collapsibles
  • Can implement internationalization in the admin panel
  • May need to update TypeScript interfaces and GraphQL schema references

Contributors:

bigmistqkeJarrodMFleschDanRibbens