nested-docs-plugin error when updating slug for parent entries
Link to reproduction
No response
Payload Version
beta.87
Node Version
20 LTS
Next.js Version
15.0.0-canary.104
Describe the Bug
I'm experiencing the same exact error Nested Docs plugin has had an error while re-saving a child document as published that's also described here: https://github.com/payloadcms/payload/issues/7694 in which the relationship between parent and child entries in a collection are not working as expected.
For example:
- I'm able to create a Parent page and then a child page for this parent with no problem.
- If I to update the
slugof the Parent page, this change is not published because of theNested Docs plugin has had an error while re-saving a child document as publishederror and the child page breadcrumbs are not updated to match the new parent page slug. - If I update the slug of the child page, the new breadcrumbs still use the previous parent slug.
Here are the steps I described above (used the beta.87 of the payload beta demo):
https://github.com/user-attachments/assets/d770410a-6eb4-442c-b5aa-8156f3caa320
This's the nested docs plugin configuration I'm using:
nestedDocsPlugin({
collections: ['pages', 'categories'],
generateLabel: (_, doc) => doc['title'] as string,
generateURL: (docs) => docs.reduce((url, doc) => `${url}/${doc['slug'] as string}`, ''),
}),
The only way I have to update the parent/child breadcrumbs to their correct values is to remove the relationship to the parent from the child page and published it, then go to the parent page and publish it (no child == no nested docs error) and then add the parent relationship again.
Also, not sure if this is the expected behaviour from the plugin-nested-docs, but currently it's possible to published a Child page when the Parent page that's related is still a draft.
In these cases, the breadcrumbs of the Child page will look like this:
Reproduction Steps
- Use the beta demo project
- Update to version 87
- Change (if necessary) the nested docs plugin configuration to the one described above
- Create the Parent and Child pages as described in the video
- See that the Parent page cannot the published and the slug changes are not present in the child pages
Adapters and Plugins
plugin-nested-docs