Home

>

Tools

>

Strapi

>

Releases

>

4.6.2

Strapi Release: 4.6.2

Tag Name: v4.6.2

Release Date: 2/22/2023

Strapi LogoStrapi

Open-source headless CMS built with Node.js. Provides developers with complete freedom in choosing their favorite tools and frameworks for frontend development.

TL;DR

Strapi v4.6.2 is a maintenance release that focuses on bug fixes and enhancements to improve stability and developer experience. Key improvements include fixes for database handling (especially for PostgreSQL JSON fields and SQLite configuration), GraphQL relation handling, media folder management, and various frontend optimizations. The release also includes dependency updates, code cleanup, and performance improvements through better async handling and fractional indexing for relations.

Highlight of the Release

    • Fixed PostgreSQL JSON field handling for simple string values
    • Added fractional indexing for relations to improve performance and reduce payload size
    • Fixed display order issues in list views with multiple relations
    • Enhanced GraphQL API to properly handle publication state and pagination in relations
    • Improved database configuration generation for all supported database clients
    • Added new API error handling utilities for better frontend error management
    • Fixed media folder update functionality

Migration Guide

No specific migration steps are required for this release as it primarily contains bug fixes and enhancements without introducing breaking changes.

If you're using PostgreSQL with JSON fields that store simple string values, you may notice improved behavior after upgrading, as this release fixes an issue with how these fields are handled.

For developers working with the GraphQL API and relations, the fixes for publication state and pagination arguments should improve functionality without requiring code changes on your part.

If you've been experiencing issues with media folder updates or asset cropping, these should be resolved after upgrading without any additional steps needed.

Upgrade Recommendations

This release is recommended for all Strapi users, especially those who:

  1. Use PostgreSQL with JSON fields containing string values
  2. Work with the GraphQL API and relations with publication state or pagination
  3. Have experienced issues with media folder management or asset cropping
  4. Use SQLite as their database with TypeScript templates

The upgrade process should be straightforward as this is a patch release with no breaking changes. Follow the standard update procedure:

npm upgrade [email protected] --save
# or
yarn upgrade [email protected]

After upgrading, restart your Strapi server to ensure all changes take effect. No database migrations or configuration changes are required for this update.

Bug Fixes

Database and Data Handling

  • PostgreSQL JSON Field Fix: Resolved an issue where PostgreSQL JSON fields weren't handling simple string values correctly
  • SQLite Configuration: Fixed the relative path for SQLite database in the default database configuration template
  • Default Locale Setting: Fixed an issue where the default locale wasn't being set when using Query Engine's createMany function

Content Management

  • Relations Display Order: Fixed an issue where children items in relations would display in incorrect order in list views
  • Media Folder Updates: Resolved a bug preventing users from updating media folders
  • Asset Cropping: Fixed an issue where cropped assets weren't maintaining their folder association

GraphQL API

  • Publication State in Relations: Fixed the GraphQL API to properly accept publication state arguments in relations
  • Pagination in Relations: Enhanced the GraphQL API to correctly handle pagination arguments in relations

Frontend and UI

  • Icon Imports: Fixed wrong import names for some icons in the Content-Type Builder
  • Mail Icon: Fixed mail icon display issues on Windows systems
  • Upload Middleware: Fixed route handling for the upload middleware

Utilities and Core

  • Async Handling: Fixed an issue with forEach async by replacing it with map async for better promise handling
  • Error Handling: Fixed various error handling issues and improved error normalization
  • TypeScript Templates: Fixed syntax errors in TypeScript configuration templates

New Features

Database Configuration Generation

The release introduces improved database configuration generation for all supported database clients. This feature enhances the developer experience by providing more comprehensive and properly configured database templates out of the box. The generated configurations now include:

  • Better environment variable handling
  • Connection pool settings
  • Schema and connection timeout configurations
  • Proper relative path handling for SQLite databases

This makes it easier to set up and configure different database types when starting a new Strapi project.

Security Updates

No significant security fixes were included in this release. However, several dependency updates were made that might include security patches:

  • Updated luxon from 1.28.0 to 1.28.1
  • Updated nodemailer from 6.8.0 to 6.9.1
  • Updated node-fetch from 2.6.7 to 2.6.9
  • Updated koa-session to 6.4.0

These updates may include security patches from the respective packages, though no specific security vulnerabilities were mentioned in the release notes.

Performance Improvements

Fractional Indexing for Relations

A significant performance improvement has been implemented through fractional indexing for relations. This enhancement reduces the payload size when reordering related items, making the operation more efficient and faster, especially for collections with many related items.

Async Utilities

The addition of reduceAsync utility function improves performance when dealing with asynchronous operations in sequence. This is particularly useful for operations that need to process items one after another while maintaining state.

Build and Bundle Optimizations

  • Removed unnecessary polyfills like node-polyfill-webpack-plugin and whatwg-fetch
  • Updated SWC compiler target to ES2020 for more efficient code generation
  • Optimized bundle size through better import handling, especially for Design System components and icons
  • Converted to single imports of Design System components to reduce bundle size

Impact Summary

Strapi v4.6.2 is a maintenance release that brings important bug fixes and enhancements to improve stability and developer experience. The most impactful changes include fixes for PostgreSQL JSON field handling, GraphQL relation queries, media folder management, and database configuration generation.

For developers, the release provides better database configuration templates, improved TypeScript support, and enhanced error handling utilities. Content managers will benefit from fixed display order in relation lists and improved media folder functionality. API consumers will see more reliable behavior with GraphQL relations, especially regarding publication state and pagination.

The performance improvements through fractional indexing for relations and better async handling will be particularly beneficial for applications with complex data structures and relationships. The various dependency updates and code cleanup efforts also contribute to a more maintainable and secure codebase.

Overall, this release represents a solid improvement in Strapi's reliability and developer experience without introducing breaking changes, making it a recommended upgrade for all users.

Full Release Notes

🔥 Bug fix

  • [core:admin] [Settings]: fix mail icon on windows (#15807) @joshuaellis
  • [core:content-manager] fix: Sometimes the children display order is incorrect in list view (#15757) @gitstart
  • [core:content-manager] [Relations]: Introduce fractional indexing for better diffing (#15818) @joshuaellis
  • [core:content-type-builder] Fix wrong import names for some icons in the CTB (#15887) @Convly
  • [core:database] Fix JSON field for postgres when the value is a simple string (#15752) @petersg83
  • [core:strapi] [Fix]: Graphql accept publication state argument in relations (#15693) @Marc-Roig
  • [core:upload] Upload middleware route & typo fix (#12666) @alexkainzinger
  • [core:upload] fix: Can not update media folder (#15771) @gitstart
  • [core:upload] fix: always return an object if data is falsey (#15831) @joshuaellis
  • [core:upload] EditAssetDialog: Only send the folderId when saving the cropped asset (#15843) @gu-stav
  • [core:utils] [Fix]: forEach async (#15881) @Marc-Roig
  • [generators:app] [Templates] Plugin deps & Custom.d.ts (#15798) @joshuaellis
  • [generators:app] Fix the relative path for sqlite database in the default database connection (#15886) @Convly
  • [plugin:graphql] [Fix]: Graphql handle pagination arguments in relations (#15715) @Marc-Roig
  • [plugin:i18n] Set default locale when using Query Engine function createMany (#15742) @petersg83
  • [typescript] Fix a tiny syntax error in config/database.ts of the template (#15853) @smorimoto

⚙️ Chore

💅 Enhancement

  • [core:content-type-builder] replace axiosInstance with getFetchClient inside the content-type builder (#15781) @simotae14
  • [core:email] replace axiosInstance with getFetchClient inside the email (#15730) @simotae14
  • [core:helper-plugin] [Helper-Plugin] getYupInnerErrors use yup params in error messaging (#15692) @jhoward1994
  • [core:utils] feat(utils): add ReduceAsync function (#15802) @nathan-pichon
  • [plugin:i18n] replace axiosInstance with useFetchClient inside the i18n plugin (#15727) @simotae14
  • [tooling] Chore: Bump swc jsc.target to es2020 (#15827) @gu-stav

🚀 New feature


📚 Update and Migration Guides

  • General update guide can be found here
  • Migration guides can be found here 📚

Statistics:

File Changed300
Line Additions6,157
Line Deletions5,929
Line Changes12,086
Total Commits234

User Affected:

  • Better database configuration generation for all supported clients
  • Fixed SQLite database path configuration in TypeScript templates
  • Improved error handling with new API error utilities
  • Enhanced TypeScript support in plugin templates
  • Fixed PostgreSQL JSON field handling for string values

Contributors:

Marc-Roigtimraasvelddependabot[bot]joshuaellisstb13579jhoward1994ronronscelestessimotae14christiancp100petersg83gitstartgu-stavM-tarek93remidejalexkainzingernathan-pichonsmorimotoalexandrebodinConvly