-
Notifications
You must be signed in to change notification settings - Fork 13
File location for relation widget #23
Comments
Thanks for opening an issue @tomrndom, I will check it out |
@tomrndom In 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. |
@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 : 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. |
Ah something's definitely off, it shouldn't fetch a local file i.e |
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 |
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 |
@tomrndom I have deployed this widget on a few private repos, so I don't think that's the issue... |
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? |
It's weird, on both sites the config it's the same
|
I've just seen this:
I'm so sorry I missed this the first time. If this is the way you want to load data then yes,
We are doing this in this repo's |
Yes I noted that, and removed that function from the cms.js file. I'm still working on it to find out a solution. |
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. |
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! |
I'm currently trying to use the relation widget with a file in Gatsby.
Right now I have a folder at src/content/ with a couple of json files that I use as settings for my page, I added a new one for the relation widget, but I can't get the relation widget to load this options from the file.
this is my CMS.js file
The error in the console says
Uncaught (in promise) TypeError: Cannot read property 'entry' of undefined at Control.<anonymous> (control.js:62) at Generator.next (<anonymous>) at fulfilled (control.js:4)
It seems this line isn't getting the options from the file
netlify-cms-widgets/packages/widget-file-relation/src/control.tsx
Line 27 in 7cd27d7
this is my config in the config.yml file
It's necesary to move my authors.json to the static folder? (same folder as config.yml file)
The text was updated successfully, but these errors were encountered: