Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access multiple objects from the same file collection #4518

Open
pmpinto opened this issue Oct 30, 2020 · 0 comments
Open

Unable to access multiple objects from the same file collection #4518

pmpinto opened this issue Oct 30, 2020 · 0 comments
Labels
area: file-handling area: ui/collection type: bug code to address defects in shipped code

Comments

@pmpinto
Copy link

pmpinto commented Oct 30, 2020

Describe the bug
I have a file with multiple objects, as such:

# my-collection.yml
first:
  # stuff nested here
second:
  # more stuff here
third:
  # more stuff here

I set this up as a file collection in the CMS, for instance:

# config.yml
collections:
  - name: 'my_collection'
    label: 'My collection'
    files:
      - label: 'First'
        name: 'first'
        file: 'my-collection.yml'
        fields:
          # many fields here
      - label: 'Second'
        name: 'second'
        file: 'my-collection.yml'
        fields:
          # many fields here

Then I go check the CMS under "My collection" and I have:

  • First
  • First

Seems to me that if I'm adding the same file under the same collection, it reuses the first occurrence of that file as many times as the number of entries under files.

To overcome this issue I'm creating multiple collections, each with 1 file, which seems inappropriate to me.

To Reproduce
Follow the set up described above 👆

Expected behavior
I would expect to have this list under "My collection":

  • First
  • Second

Applicable Versions:

  • Netlify CMS version: 2.10.66
  • Git provider: GitHub
  • OS: macOS Catalina (10.15.6)
  • Browser version: Brave 1.14.84
  • Node.JS version: 12.17.0

CMS configuration
See above 👆

@pmpinto pmpinto added the type: bug code to address defects in shipped code label Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: file-handling area: ui/collection type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants