Giter Club home page Giter Club logo

Comments (13)

tomrndom avatar tomrndom commented on June 27, 2024 1

I made a reproduction repository but the thing is, that it's working perfectly on this new one. I don't know if could it be an netlify cache issue, I recently face many of those when I uploaded some changes that affected the CMS. Will make some test to make it work. Thanks

https://dreamy-knuth-40c8d6.netlify.com/admin/

https://github.com/tomrndom/netlify-cms-relation-widget

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024 1

Ahh so that's what it is. The good news is the folks over netlifyCMS has just merged the fix for this.

Once they release a new update, I will release a patch as well. Thank you for using this library + sharing your debug process, I really appreciate it.

If you'd like, you can subscribe to #25 to get update on the (very soon) patch!

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024

Thanks for opening an issue @tomrndom, I will check it out

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024

@tomrndom In config.yml, The file field should be the name of the file, instead of the file location:

    files:
      - file: "src/content/authors.json"
        label: "Authors"
        name: "authors"  # <-- use this field

...

      - label: "Author"
        name: "author"
        widget: ncw-file-relation 
        collection: configurations
-       file: "src/content/authors.json"
+       file: authors
        target_field: authors, id_field: id
        display_fields: name

Let me know if that works! I should really make the document better, sorry about that.

from netlify-cms-widgets.

tomrndom avatar tomrndom commented on June 27, 2024

@d4rekanguok Thanks for you response, I'm currently trying changing the file path to the name of the file, but I'm getting this error :

imagen

Seems like the loadData function isn't fetching the json file from the src/content/ folder. Insteed of the file, I'm getting an 404 html response.

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024

Ah something's definitely off, it shouldn't fetch a local file i.e /admin/src/content/authors.json, it should fetch it from github instead. I'll try to reproduce this with the bit of info you have given, but it'd be awesome if you could put together a reproduction repo 🙏 Thanks @tomrndom!

from netlify-cms-widgets.

tomrndom avatar tomrndom commented on June 27, 2024

Could it be that my repo it's private, and netlify-cms cannot fetch the file from a private repository?

It seems like that's the only difference between the reproduction repo and the one I was trying to implement the widget.

I'm noticing on the network tab that, on the reproduction repo, the site fetch the file, and not in the others repositories

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024

@tomrndom I have deployed this widget on a few private repos, so I don't think that's the issue...
However I've just found an issue with latest version of netlify-cms-app. Could you try again, but pin your netlify-cms-app version to exactly 2.9.7?

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024

Oh I've just seen the edit -- I doubt that this is the cause then. :( Perhaps something to do with your backend setup in config.yml?

from netlify-cms-widgets.

tomrndom avatar tomrndom commented on June 27, 2024

It's weird, on both sites the config it's the same

backend:
  name: git-gateway
  branch: master

from netlify-cms-widgets.

d4rekanguok avatar d4rekanguok commented on June 27, 2024

I've just seen this:

const loadData = async (dataPath) => {
  const data = await fetch(dataPath)
    .then(data => data.json())
    .catch(err => console.error(err))

  window.repoFiles = data
}

loadData('src/content/authors.json');

I'm so sorry I missed this the first time. If this is the way you want to load data then yes, authors.json must be in the static directory, and you'd need to change the path to

loadData('/authors.json')

We are doing this in this repo's packages/playground, but it's only because we don't want to set up a backend for the demo project 😅 if you're using git-gateway, you shouldn't use repoFiles (it's for test-repo only)

from netlify-cms-widgets.

tomrndom avatar tomrndom commented on June 27, 2024

Yes I noted that, and removed that function from the cms.js file. I'm still working on it to find out a solution.

from netlify-cms-widgets.

tomrndom avatar tomrndom commented on June 27, 2024

Welp it seems it was a problem with the version of netlify-cms-app, it's working with the 2.9.7 version but not with the 2.11.29.

from netlify-cms-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.