Skip to main content

webhooks.populateRelations 服务器配置已被删除

¥The webhooks.populateRelations server configuration is removed

在 Strapi 5 中,webhook 已重构,webhook.populateRelations 选项将变得多余。这可能会影响生命周期,期望返回的创建、更新和删除关系被填充。

¥In Strapi 5, webhooks have been refactored and the webhook.populateRelations option will become redundant. This might affect lifecycles expecting the returned relations of create, update and delete to be populated.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥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.

\🔌 此重大更改是否会影响插件?\
\🤖 此重大更改是否由 codemod 自动处理?\

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

当以任何方式创建、更新或修改条目时,Content Manager 后端的响应负载将返回每个关系字段的关系总数。

¥When an entry is created, updated, or modified in any way, the response payload of the Content Manager backend returns the total count of relations for every relational field.

你可以在内容管理器编辑视图中看到关系顶部正在使用的计数:

¥You can see the count being used at the top of the relation in the Content Manager Edit view:

Content-Manager screenshot that shows populated relations count

实际关系值是使用另一个端点获取的。这是为了提高内容管理器请求的性能。

¥The actual relational values are fetched using another endpoint. This was made to enhance the performance of the Content Manager requests.

要简化 webhook 的使用,你可以启用(参见 服务器配置)。启用后,所有关系值都会填充并发送给 webhook 消费者,从而导致性能下降。

¥To simplify webhook consumption, you can enable the (see server configuration). When enabled, all relations values are populated and sent to the webhook consumers, resulting in performance decrease.

在 Strapi 5 中

¥In Strapi 5

Webhooks 将被重构,因此 webhooks.populateRelations 配置不是必需的,但更改填充方式可能会影响其他事项,例如数据库生命周期,期望返回的创建、更新和删除关系被填充。

¥Webhooks will be refactored, so the webhooks.populateRelations configuration is not necessary, but changing how things are populated might impact other things like database lifecycles expecting the returned relations of create, update and delete to be populated.

迁移

¥Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

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

注意

¥Notes

重构 webhook 后将提供更多信息。

¥Additional information will be given once the webhooks are refactored.

手动程序

¥Manual procedure

中继式查询可用于获取多个文档并返回元信息:

¥Relying on any input populate values on database layer is not reliable, so if necessary in your custom code base, the lifecycle should always fetch the necessary data.