Skip to main content

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

🌐 The webhooks.populateRelations server configuration is removed

在 Strapi 5 中,网页钩子已经被重构,webhook.populateRelations 选项将变得多余。这可能会影响依赖于 create、update 和 delete 返回关系已填充的生命周期。

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

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

重大变更描述

🌐 Breaking change description

在 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 中

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

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