fix(plugin-nested-docs): corrects data shape of breadcrumbs returned in hooks (#10866)

### What?
The `plugin-nested-docs` returns an array of breadcrumbs - the
`resaveChildren` file accidentally processed the breadcrumbs twice, once
where the data is updated and once within the `populateBreadcrumbs`
function which was causing the objects to be double nested.

### How?
Removes the extra nesting from `resaveChildren` file and allows the
`populateBreadcrumbs` to return the final data.

Fixes #10855
This commit is contained in:
Jessica Chowdhury
2025-02-24 16:10:21 +00:00
committed by GitHub
parent d32608649c
commit d92c0009ed
2 changed files with 86 additions and 5 deletions

View File

@@ -81,10 +81,7 @@ const resave = async ({ collection, doc, draft, pluginConfig, req }: ResaveArgs)
await req.payload.update({
id: child.id,
collection: collection.slug,
data: {
...child,
[breadcrumbSlug]: await populateBreadcrumbs(req, pluginConfig, collection, child),
},
data: populateBreadcrumbs(req, pluginConfig, collection, child),
depth: 0,
draft: isDraft,
locale: req.locale,