decaporg / decaporg/decap-cms

Edit API gets confused with nested collections

Open
#4,753 0 comments 0 reactions 0 assignees View on GitHub
area: open authoring type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

I am using both the beta features [nested collections](https://www.netlifycms.org/docs/beta-features/#nested-collections) combined with [open authoring](https://www.netlifycms.org/docs/open-authoring/) to allow for edits from external contributors. My use case is [an opensource documentation project](https://5fe12e7ded871e0007d3dd95--stackbit-gatsby-theme-diy-libris.netlify.app/).

As indicated in the open authoring doc, there is an [edit api to build direct links to the admin panel to edit a specific page](https://www.netlifycms.org/docs/open-authoring/#linking-to-specific-entries-in-the-cms). However, it gets confused with nested collections.

Here are a set of links I built, followed by where netlifyCMS redirects to, and finally what is the correct path in the admin panel (that I found by navigating netlifyCMS UI directly instead of using the edit API):

```
collection: docs

/admin/#/edit/docs/index # edit API URL I built
/admin/#/collections/docs/entries/index # redirects to this, it works
/admin/#/collections/docs/entries/index # the complete URL when navigating through netlifyCMS, works too

/admin/#/edit/docs/about/index
/admin/#/collections/docs/entries/about # FAIL
/admin/#/collections/docs/entries/about/index # Correct URL

/admin/#/edit/docs/about/features/index
/admin/#/collections/docs/entries/about # FAIL
/admin/#/collections/docs/entries/about/features/index # Correct URL

/admin/#/edit/docs/about/features/featuressub/index
/admin/#/collections/docs/entries/about # FAIL
/admin/#/collections/docs/entries/about/features/featuressub/index # Correct URL
```

All these can be tested live [here](https://5fe12e7ded871e0007d3dd95--stackbit-gatsby-theme-diy-libris.netlify.app/docs/).

As you can see, it seems the edit API gets stuck at the root level of the collections, it doesn't know how to parse deeper levels.

The issue seems to be that the URL is truncated for some reason by netlifyCMS.

I am using the latest stable netlifyCMS of the branch ^v2.0.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.