Home

>

Tools

>

Strapi

>

Releases

>

3.4.0

Strapi Release: 3.4.0

Tag Name: v3.4.0

Release Date: 12/17/2020

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 v3.4.0 introduces a major enhancement to the Content Manager with the ability to display relational fields in the list view. This update allows users to see, sort, and filter by related content directly in the list interface. The release also includes improvements to the CLI, documentation updates, and various bug fixes. A migration guide is available for users upgrading from v3.3.x.

Highlight of the Release

    • Display relational fields in the list view, allowing users to see, sort, and filter by related content
    • Improved create-strapi-app templates for better developer experience
    • Ability to disable aggregation in GraphQL for performance optimization
    • Major refactoring of the Content Manager for better maintainability
    • Enhanced UI with tooltips for many-to-many relations preview

Migration Guide

Migration from v3.3.x to v3.4.0

Relation fields migration

If you're upgrading from v3.3.x to v3.4.0, you'll need to run a migration script to update your database structure for the new relational fields feature. Follow these steps:

  1. Create a migration script file in your project:
// ./scripts/migrate-relation-fields.js
'use strict';

const fs = require('fs');
const path = require('path');

async function migrate() {
  const appContext = await strapi.compile();
  await strapi.start();

  try {
    console.log('Starting migration...');
    
    // Get all content types
    const contentTypes = Object.values(strapi.contentTypes);
    
    for (const contentType of contentTypes) {
      // Skip non-content type models
      if (contentType.modelName === 'core_store' || !contentType.uid.includes('::')) {
        continue;
      }
      
      console.log(`Migrating ${contentType.uid}...`);
      
      // Get the model configuration
      const modelConfig = await strapi.db.config.get(contentType.uid);
      
      if (!modelConfig) {
        continue;
      }
      
      // Check if there are relation fields
      const hasRelationFields = Object.values(contentType.attributes).some(
        attribute => attribute.type === 'relation'
      );
      
      if (!hasRelationFields) {
        continue;
      }
      
      // Get current list view settings
      const listViewConfig = modelConfig.settings?.listView;
      
      if (!listViewConfig) {
        continue;
      }
      
      // Update the configuration
      await strapi.db.config.update(contentType.uid, {
        settings: {
          ...modelConfig.settings,
          listView: listViewConfig,
        },
      });
    }
    
    console.log('Migration completed successfully!');
  } catch (error) {
    console.error('Migration failed:', error);
  }
  
  process.exit(0);
}

migrate();
  1. Run the migration script:
node ./scripts/migrate-relation-fields.js
  1. After successful migration, you can delete the script file.

Other changes

  • Review your GraphQL queries if you're using the GraphQL plugin, as the aggregation behavior can now be disabled
  • Check your custom components that might interact with the Content Manager, as there have been significant refactoring changes

Upgrade Recommendations

This release contains significant improvements to the Content Manager, especially for applications with complex relational data models. The upgrade is recommended for all users, particularly those who work with related content frequently.

Upgrade Steps:

  1. Update your Strapi version in your package.json:

    "dependencies": {
      "strapi": "3.4.0",
      "strapi-admin": "3.4.0",
      "strapi-connector-bookshelf": "3.4.0",
      "strapi-plugin-content-manager": "3.4.0",
      "strapi-plugin-content-type-builder": "3.4.0",
      "strapi-plugin-email": "3.4.0",
      "strapi-plugin-graphql": "3.4.0",
      "strapi-plugin-upload": "3.4.0",
      "strapi-plugin-users-permissions": "3.4.0",
      "strapi-utils": "3.4.0"
    }
    
  2. Run npm install or yarn install to update dependencies

  3. Run the migration script as described in the migration guide

  4. Start your Strapi application and verify that relational fields are working correctly

  5. Review and configure which relational fields you want to display in your list views

The upgrade process should be relatively straightforward, but as always, it's recommended to test in a development environment before updating production.

Bug Fixes

  • Collection Type Sorting: Fixed an issue with ascending sort in the Content-Types Builder's left menu
  • CLI Version Display: Fixed strapi -v and strapi --version commands that weren't displaying the version correctly
  • Database Migration: Fixed migration issues when disabling draft & publish on SQLite databases
  • Users-Permissions: Fixed subdomain condition handling when subdomain is an empty string
  • Repeatable Component DnD: Fixed drag and drop functionality for repeatable components
  • UI Fixes: Various UI improvements and fixes throughout the admin panel
  • MongoDB: Fixed many-to-many preview with MongoDB

New Features

Relational Fields in List View

The major new feature in this release is the ability to display relational fields in the Content Manager's list view. This enhancement provides several benefits:

  • Visibility: View related content directly in the list without opening each entry
  • Sorting: Sort content based on related fields' values
  • Filtering: Filter content by related fields
  • Preview: Tooltips show previews of related content for many-to-many relationships
  • Counters: Display the number of related items for one-to-many and many-to-many relationships

This feature significantly improves content management workflows by providing better visibility and organization of related content.

Security Updates

No specific security fixes were mentioned in this release.

Performance Improvements

  • GraphQL Aggregation Control: Added ability to disable aggregation in GraphQL, which can improve performance for large datasets or complex queries
  • Code Refactoring: Significant refactoring of the Content Manager components and data management logic, which should result in better performance and maintainability
  • Data Fetching Optimization: Split fetch data and data management logic for more efficient operations
  • Relation Handling: Optimized handling of relational data, particularly for displaying and counting related items

Impact Summary

Strapi v3.4.0 represents a significant enhancement to the platform's content management capabilities, particularly for applications with complex data relationships. The ability to display, sort, and filter by relational fields in the list view addresses a long-standing limitation and greatly improves the content editing experience.

The major refactoring of the Content Manager's internal architecture, while not immediately visible to end users, provides a more solid foundation for future features and improvements. This refactoring touched many parts of the codebase (over 12,000 lines changed across 300 files), indicating the scope of the improvements.

For developers, the enhanced template system in create-strapi-app and the ability to disable GraphQL aggregation provide more flexibility and control. The various bug fixes, particularly around collection type sorting and database migrations, address pain points reported by the community.

Overall, this release focuses on improving the day-to-day experience of content editors and administrators while providing developers with a more robust and flexible platform. The changes are evolutionary rather than revolutionary, building on Strapi's existing strengths while addressing known limitations.

Full Release Notes

You can follow the migration guide here 🔥

🚀 New feature

💅 Enhancement

🌏 Translation

  • [admin] [admin, translations] Translate documentation plugin and add German translations to index of upload plugin (#8803) @pr0gr8mm3r
  • [plugin:upload] Add some admin french translations (#8665) @robinsimonklein

🐛 Bug fix


📚 Migration guides can be found here 📚

Statistics:

File Changed300
Line Additions7,223
Line Deletions5,590
Line Changes12,813
Total Commits250

User Affected:

  • Can now view relational data directly in the list view without having to open each entry
  • Can sort and filter content by relational fields
  • Benefit from improved UI for managing related content

Contributors:

soupettealexandrebodinHichamELBSIMeXaaRdependabot[bot]AurelsicokoMcastrespetersg83Convlyjorritakhilmhdhrobinsimonkleinremidejdiogotcorreiagaycookiepiersrobertspierreburgys3n-w6i