Skip to main content

The ContentManagerAppState redux is modified

In Strapi 5, the redux store for the Content Manager has been changed and some redux actions were removed. Notably, the useContentManagerInitData redux state for the Content Manager has been refactored to remove ModelsContext. Users might be relying on the original structure in a middleware or subscriber; doing so this will break their application.

This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

🔌 Is this breaking change affecting plugins?Yes
🤖 Is this breaking change automatically handled by a codemod?No

Breaking change description

In Strapi v4

The redux store can fire the following actions:

  • 'ContentManager/App/RESET_INIT_DATA’
  • 'ContentManager/App/GET_INIT_DATA’
  • 'ContentManager/App/SET_INIT_DATA’

The payload nests attributes inside the data object. For instance, for the SET_INIT_DATA action, the payload is of the following format:

  data: {
authorizedCollectionTypeLinks: ContentManagerAppState['collectionTypeLinks'];
authorizedSingleTypeLinks: ContentManagerAppState['singleTypeLinks'];
components: ContentManagerAppState['components'];
contentTypeSchemas: ContentManagerAppState['models'];
fieldSizes: ContentManagerAppState['fieldSizes'];
};

In Strapi 5

The redux store no longer fires the following actions:

  • 'ContentManager/App/RESET_INIT_DATA’
  • 'ContentManager/App/GET_INIT_DATA’

The payload data does not nest attributes within a data object anymore. For instance, for the SET_INIT_DATA action, the payload is of the following format:

{
authorizedCollectionTypeLinks: ContentManagerAppState['collectionTypeLinks'];
authorizedSingleTypeLinks: ContentManagerAppState['singleTypeLinks'];
components: ContentManagerAppState['components'];
contentTypeSchemas: ContentManagerAppState['models'];
fieldSizes: ContentManagerAppState['fieldSizes'];
}

Migration

This section regroups useful notes and procedures about the introduced breaking change.

Manual procedure

The redux store in Strapi 5 continues to fire 'ContentManager/App/SET_INIT_DATA’, so users should instead listen for this action in their middlewares only.

Additionally, adjustments to your custom code might need to be done based on the new payload format.