Home

>

Tools

>

Payload CMS

>

Releases

>

Release 1.0.5

Payload CMS Release: Release 1.0.5

Tag Name: v1.0.5

Release Date: 7/19/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.0.5 introduces a new initAsync method that allows for asynchronous initialization of the CMS. This is particularly useful for scenarios where you need to perform asynchronous operations during the initialization process. The update maintains backward compatibility while providing more flexibility for developers working with asynchronous code.

Highlight of the Release

    • New initAsync method for asynchronous initialization of Payload CMS
    • Updated type definitions for onInit for better TypeScript support
    • Maintained backward compatibility with existing initialization patterns

Migration Guide

No migration is required for this release. The new initAsync method is provided as an additional option alongside the existing initialization method, ensuring backward compatibility.

If you wish to use the new asynchronous initialization:

// Before (synchronous)
payload.init({
  // config options
});

// After (asynchronous)
await payload.initAsync({
  // config options
});

Your existing code using the synchronous init method will continue to work without changes.

Upgrade Recommendations

This is a minor feature release that adds functionality without breaking changes. It's safe to upgrade from v1.0.4 to v1.0.5 without concerns about backward compatibility.

To upgrade:

npm install [email protected]
# or
yarn add [email protected]

Consider adopting the new initAsync method if your application would benefit from asynchronous initialization, particularly if you need to wait for external resources or perform other async operations during startup.

Bug Fixes

No specific bug fixes were included in this release.

New Features

initAsync Method

The primary feature in this release is the addition of the initAsync method, which enables asynchronous initialization of Payload CMS. This method allows developers to:

  • Perform asynchronous operations during the initialization process
  • Wait for external resources or services before completing initialization
  • Handle promises and async/await patterns more naturally in the initialization flow

Example usage:

// Async initialization
const payload = await payload.initAsync({
  secret: 'your-secret-key',
  mongoURL: 'your-mongo-connection-string',
  // other config options
});

// Now you can be sure initialization is complete
console.log('Payload initialized successfully');

This complements the existing synchronous initialization method, giving developers more flexibility in how they structure their application startup.

Security Updates

No security fixes were included in this release.

Performance Improvements

No specific performance improvements were documented in this release.

Impact Summary

This release introduces asynchronous initialization capabilities to Payload CMS through the new initAsync method. While this is a relatively small addition in terms of code changes, it provides significant flexibility for developers working with modern JavaScript/TypeScript applications where asynchronous patterns are common.

The update to the onInit type definition improves TypeScript support, making the developer experience more robust when working with initialization hooks.

Overall, this release enhances Payload's API without disrupting existing implementations, making it a safe and beneficial upgrade for most users.

Full Release Notes

Statistics:

File Changed7
Line Additions721
Line Deletions737
Line Changes1,458
Total Commits5

User Affected:

  • Can now initialize Payload asynchronously using the new `initAsync` method
  • Have more flexibility when working with asynchronous operations during CMS initialization
  • Can maintain existing code as the traditional initialization method is still supported

Contributors:

denolfejmikrut