Home

>

Tools

>

Payload CMS

>

Releases

>

Release 0.15.0

Payload CMS Release: Release 0.15.0

Tag Name: v0.15.0

Release Date: 3/16/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 v0.15.0 introduces a powerful new versioning system with drafts and autosave functionality. This major update allows content creators to work with draft content, compare versions, and restore previous versions. The release also includes significant improvements to the rich text editor with indentation controls and enhanced upload capabilities, better relationship field performance, and numerous bug fixes for a more stable experience.

Highlight of the Release

    • New versioning system with drafts and autosave functionality
    • Enhanced rich text editor with indentation controls and improved upload handling
    • Better relationship field performance and pagination
    • Improved access control with more granular options for versions and drafts
    • Numerous bug fixes and stability improvements

Migration Guide

Upgrading to v0.15.0

Versioning System Configuration

If you want to use the new versioning system, you'll need to add configuration to your collections and globals:

// For collections
{
  slug: 'posts',
  // ... other collection config
  versions: {
    drafts: true, // Enable drafts
    autosave: true // Enable autosave (requires drafts: true)
  }
}

// For globals
{
  slug: 'header',
  // ... other global config
  versions: {
    drafts: true, // Enable drafts
    autosave: true // Enable autosave (requires drafts: true)
  }
}

Rich Text Editor Indentation

The rich text editor now supports indentation. No configuration changes are needed to use this feature.

Custom Fields for Rich Text Uploads

To add custom fields to uploads in rich text editor:

{
  name: 'content',
  type: 'richText',
  admin: {
    upload: {
      collections: {
        'media': {
          fields: [
            {
              name: 'caption',
              type: 'text',
              label: 'Caption'
            }
          ]
        }
      }
    }
  }
}

Using the Versions API

To work with versions through the Local API:

// Get versions for a document
const versions = await payload.findVersions({
  collection: 'posts',
  id: '123'
});

// Get a specific version
const version = await payload.findVersionByID({
  collection: 'posts',
  id: '123',
  versionID: '456'
});

// Restore a version
await payload.restoreVersion({
  collection: 'posts',
  id: '123',
  versionID: '456'
});

Note on Dependencies

This version requires Node.js v14+ and may require using the --legacy-peer-deps flag when installing due to dependency updates.

Upgrade Recommendations

Recommended for: All users of Payload CMS, especially those who need content versioning, drafts, or autosave functionality.

Priority: Medium to High

This is a significant feature release that introduces powerful content management capabilities without breaking existing functionality. The versioning system alone makes this upgrade worthwhile for most content-focused applications.

Upgrade Steps:

  1. Update your Payload dependency to v0.15.0:

    npm install [email protected] --legacy-peer-deps
    

    Note: The --legacy-peer-deps flag may be necessary due to dependency updates.

  2. If you have custom field types or plugins, test them thoroughly with this new version.

  3. Review your access control policies, especially if you plan to implement the versioning system, as there are new permissions to consider.

  4. Update your TypeScript types if you're using TypeScript, as there are several new types related to versions.

  5. Consider implementing the versioning system for your collections and globals where appropriate.

No database migrations are required for this update, but enabling versions will create new collections in your database to store version data.

Bug Fixes

UI and Interaction Fixes

  • Fixed mobile styling on not found page
  • Prevented loading edit views until data initializes
  • Fixed inability to clear localized property values
  • Improved relationship field option loading
  • Fixed issues with searching in relationship fields
  • Prevented "None" from appearing in hasMany relationship select options

Data Handling Fixes

  • Fixed bug in how find merges drafts
  • Ensured empty hasMany relationships save as empty arrays
  • Fixed saving of cleared number values
  • Ensured revisions retain all locales
  • Fixed multipart/form-data handling to retain non-string values
  • Fixed bug with version count accuracy

Rich Text Fixes

  • Fixed key generation for RichText based on initialValue
  • Fixed rare crash with link RTE element
  • Ensured nested lists always render properly

Access Control and Security

  • Fixed GraphQL upload access control
  • Ensured overrideAccess is false if undefined while populating
  • Fixed JWT to work without CSRF in config
  • Fixed empty and sparse CSRF configuration handling

New Features

Versioning System

  • Complete versioning system for both collections and globals
  • Draft content support with ability to work on unpublished changes
  • Autosave functionality to prevent content loss
  • Version comparison with visual diffs between versions
  • Ability to restore previous versions
  • Version history with detailed information

Rich Text Editor Improvements

  • Added indentation controls for better content formatting
  • Enhanced upload handling with custom fields for uploaded media
  • Improved link handling and void element insertion
  • Better nested list rendering

API Enhancements

  • GraphQL version collection resolvers
  • Local API for versions on globals
  • Path information added to GraphQL errors
  • Pagination argument to optimize GraphQL relationships

Field Improvements

  • Field hooks now receive sibling data
  • Original document provided to field access control
  • Empty string values now allowed in radio and select options
  • Better relationship field performance with optimized querying

Security Updates

Access Control Improvements

  • Fixed GraphQL upload access control to properly respect permissions
  • Added ability for global access control to return query constraints
  • Exposed original document to field access control for better security checks
  • Improved access control for preventing reading of drafts

Authentication and Authorization

  • Fixed JWT to work without CSRF in config for certain scenarios
  • Improved CSRF configuration handling
  • Better sanitization of server URL to prevent undefined in admin routes

Performance Improvements

Relationship Field Optimization

  • Significantly improved relationship field performance with optimized querying
  • Added pagination argument to optimize GraphQL relationships and local API usage
  • Prevented loading duplicative relationship options

Rich Text Editor Performance

  • Better handling of rich text elements for improved editor performance
  • Optimized rendering of nested lists and indentation

Autosave Optimization

  • Implemented debounce in autosave to reduce unnecessary saves
  • Optimized version operations for better performance

Query Optimization

  • Improved how find merges drafts for better query performance
  • Optimized version comparison functionality
  • Enhanced version history loading

Impact Summary

Payload CMS v0.15.0 represents a significant evolution in the platform's content management capabilities with the introduction of a comprehensive versioning system. This system includes drafts, autosave, version comparison, and restoration features that dramatically improve the content editing experience.

The versioning system allows content editors to work on drafts without affecting published content, automatically save their work to prevent data loss, compare different versions with visual diffs, and restore previous versions when needed. This brings Payload in line with enterprise CMS features while maintaining its developer-friendly approach.

Rich text editing has been substantially improved with indentation controls and enhanced upload handling, allowing for more sophisticated content formatting and media management. The ability to add custom fields to uploaded media within rich text provides greater flexibility for content teams.

For developers, the release offers significant performance improvements, particularly in relationship fields and GraphQL queries. The addition of pagination to relationship queries helps optimize data loading for large datasets. Access control has been enhanced with more granular options for versions and drafts, improving security while maintaining flexibility.

The numerous bug fixes address issues across the platform, from UI interactions to data handling, making this a stable and worthwhile upgrade for all Payload users.

Full Release Notes

0.15.0 (2022-03-16)

Bug Fixes

  • #422, prevents loading duplicative relationship options (414679d)
  • #423, #391 - prevents loading edit views until data initializes (2884654)
  • #424, unable to clear localized property vals (1a05fe4)
  • #431 - relationship field not properly fetching option results (6fab8bf)
  • #454, withCondition type usability (56c16d5)
  • #459 - in Relationship field to multiple collections, when the value is null, options are not populated (#460) (a9b83c8)
  • #461 (08924a1)
  • #464, graphql upload access control (fd0629e)
  • adds key to RichText based on initialValue (f710b8c)
  • adjusts lte and gte types to match docs and codebase (#480) (8fc4f7f)
  • allow jwt to work without csrf in config (4048734)
  • autosave (e835cbe)
  • avoids console 404 on unpublished docs (c7c3418)
  • awaits beforeDelete hooks (609b871)
  • bug in how find merges drafts (1fb1eaa)
  • bug with version count (6bf7d82)
  • config empty and sparse csrf is now allowed (7e7b058)
  • ensures empty hasMany relationships save as empty arrays (08b3e8f)
  • ensures fetching published doc only retrieves published docs (7841f2a)
  • ensures multipart/form-data using _payload flattens field data before sending (ae44727)
  • ensures nested lists always render properly (20e5dfb)
  • ensures overrideAccess is false if undefined while populating (97f3178)
  • ensures revision hooks await promises (f56bbe8)
  • ensures revisions retain all locales (f246252)
  • ensures rte upload is populated when only upload is enabled (39438b8)
  • ensures unique is not set within revisions collections (b13615f)
  • ensures VersionCount is accurate (7569811)
  • ensures versions have proper data (0ba508a)
  • further sanitize serverURL to prevent undefined in admin routes (#481) (24aa475)
  • import path for createRichTextRelationshipPromise (586cd4d)
  • improperly typed local create method (48aa27c)
  • improves version config sanitization (fc24485)
  • mobile styling to not found page (d3f88a1)
  • new slate version types (c5de01b)
  • optimizes relationship input search querying (7e69fcb)
  • prevents None from appearing in hasMany relationship select options (cbf43fa)
  • rare crash with link rte element (f5535f6)
  • removes required from versions status field (03c8445)
  • rte upload field population (8327b5a)
  • type error in useField (ef4e6d3)
  • uses replace instead of push to autocreate a doc (a7ecada)
  • version where input type (a5c8ea4)

Features

  • #458, provides field hooks with sibling data (8e23a24)
  • abstracts revisions components for reuse in globals (da5684d)
  • add before and after login components (#427) (5591eea)
  • add local api for versions on globals (4072e7e)
  • add logMockCredentials email option (ff33453)
  • add pagination argument to optimize graphql relationships and use in local api (#482) (647db51)
  • adds a way to customize express.static options (dbb3c50)
  • adds admin.upload.collections[collection-name].fields to the RTE to save specific data on upload elements (3adf44a)
  • adds autosave to versions table (14e5d09)
  • adds base revision fields (6ed11a5)
  • adds indentation controls to rich text (7df50f9)
  • adds most recently published comparison doc (1e093e1)
  • adds originalDoc to field access control (c979513)
  • adds path to GraphQL errors (#457) (ad98b29)
  • adds recursion to richText field to populate relationship and upload nested fields (42af22c)
  • adds restore revisions to collections (5eea398)
  • adds stepnav to revisions template (a589877)
  • allow empty string radio and select option values (#479) (f14e187)
  • allows access control to prevent reading of drafts (c38470c)
  • allows global access control to return query constraints (c0150ae)
  • allows select input to receive new options (#435) (500fb1c)
  • allows selection of revisions in certain locales to compare (f572230)
  • attempts to render rich text diffs more appropriately (7bd60b5)
  • builds a way for multipart/form-data reqs to retain non-string values (65b0ad7)
  • builds a way for multipart/form-data reqs to retain non-string values (4efc2cf)
  • builds autosave into existing update operation (de48f44)
  • builds global publishVersion (7397d63)
  • builds group and iterable diffs (bddaefd)
  • builds remainder of diff field types (a479770)
  • builds revert to saved, unpublish (160ab54)
  • builds revisions list view (1920a93)
  • builds revisions models (0686126)
  • creates global revisions (ec82b92)
  • disables LeaveWithoutSaving if autosave enabled (01d07bc)
  • enhances rich text upload with custom field API (0e4eb90)
  • ensures field hooks run on all locales when locale=all (c3f743a)
  • ensures revisions are created and deleted accordingly (8df767e)
  • exposes data arg within create and update access control (73f418b)
  • exposes FieldWithPath type for reuse (df3a836)
  • exposes useLocale for reuse (bef0206)
  • finishes revision restore (0e093bf)
  • functional autosave (e910d89)
  • further revisions views (740d6b1)
  • GraphQL version collection resolvers (7cfb2f7)
  • implements versions in global ui (eb4f957)
  • implements versions in globals, adds tests (a59b14b)
  • improve code coverage for graphql versions (26b13a8)
  • improves adding rich text voids to RTE (966c3c6)
  • improves relationship field performance (13318ff)
  • improves rich text link (2e9a4c7)
  • improves versions UI count and list view (e81ba84)
  • indexes filenames (07c8ac0)
  • merges back in logic for non draft versions and draft versions (ed8abd9)
  • optimization of unpublish, revert to saved (4e773c7)
  • progress to Autosave (13add58)
  • progress to draft types (b59bb0b)
  • progress to drafts (be1da85)
  • progress to restore revision (2e946a0)
  • progress to revision restore (210488b)
  • progress to saving drafts manually (71c49bc)
  • removes mongoose required (4fbddee)
  • renames revisions to versions (3a71afb)
  • renders diffs (245e12e)
  • reorders version creation (cd0e172)
  • revision access control config (ac53bac)
  • rich text indent PoC (2deed8b)
  • scaffold of individual Revision view (40f93e9)
  • scaffolds admin revisions (7253710)
  • scaffolds drafts / autosave config (066b593)
  • scaffolds new revisions operations and rest routes (4a445f0)
  • scaffolds revisions tests (fbbe590)
  • serverURL is no longer required (#437) (dca90c4)
  • styles multiple collection actions (0463982)
  • tests & autosave improvements (7220ff7)
  • updates dependencies (3ca3f53)
  • uses debounce in autosave (ee9cd24)
  • uses DocumentInfo to fetch and maintain doc versions (8f30c3b)
  • wires up restore (189bc21)
  • working autosave (c62707c)
  • working drafts (b00517e)

Statistics:

File Changed300
Line Additions8,349
Line Deletions1,878
Line Changes10,227
Total Commits231

User Affected:

  • Can now work with draft content before publishing
  • Benefit from autosave functionality to prevent content loss
  • Can compare different versions of content and restore previous versions
  • Improved rich text editor with indentation controls and better upload handling

Contributors:

jmikrutDanRibbensoranoranJarrodMFleschdenolfejacobsfletch