tinacms / tinacms

A fully open-source headless CMS that supports Markdown and Visual Editing
https://tina.io
Apache License 2.0
11.18k stars 562 forks source link

Unable to navigate to new folders in self hosted tina + separate content repo setup #4439

Open jasonrobwebster opened 2 months ago

jasonrobwebster commented 2 months ago

I am currently using self hosted tina with a seperate content repo.

I can create new files via the /admin/index.html page just fine, however, if I create try to create a file in a new subfolder, the admin page won't recognize this subfolder and thus this new file is lost to content creators. The file, and subfolder, are created correctly in the github repo - the issue is that the file and folder don't seem to be indexed by tina when the document is created.

Creating a new blog post in a subfolder: image

Back to admin page, missing the subfolder and new file: image

Folder and file correctly created in github: image

Reproduction

https://tina-self-hosted-content-repo-bug.vercel.app/admin#/collections/post/~

Steps to reproduce

  1. Log in to admin page with username & password admin & admin.
  2. Verify blog post can be created via the admin panel
  3. Attempt to create a subfolder by prepending a subfolder name to the filename path e.g. <subfolder_name>/filename
  4. Verify that no subfolder or file can be found via the admin navigation
  5. Verify that the file has been properly created in the separate content repo: https://github.com/jasonrobwebster/tina-demo-content-repo/tree/main/content/posts

Public repos:

System Info

  System:
    OS: Linux 6.6 Pop!_OS 22.04 LTS
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 6.82 GB / 15.00 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.4.0 - ~/.nvm/versions/node/v20.4.0/bin/node
    Yarn: 1.22.19 - ~/tina-self-hosted-content-repo-bug/node_modules/.bin/yarn
    npm: 9.7.2 - ~/.nvm/versions/node/v20.4.0/bin/npm
    pnpm: 7.32.4 - ~/.nvm/versions/node/v20.4.0/bin/pnpm
  Browsers:
    Chrome: 121.0.6167.184
  npmPackages:
    @tinacms/cli: ^1.5.34 => 1.5.34 
    tinacms: ^1.5.28 => 1.5.28 

Validations

jasonrobwebster commented 2 months ago

Also just to note, and potentially a separate issue, but when running tinacms build, the indexing step will find and index folders in the local content folder, not the separate content repo.

If the local content folder and separate content repo structures match (i.e. same folders, same filenames, irrespective of file content), then the admin page will display the folders.

My guess is that the indexing step is what's leading to the schema to find the folder, but this step is missed on document creation.