-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Confusing behavior when you add collection config without creating entry file #929
Comments
cc/ @erquhart |
I checked, this goes back to 0.4.0 at least. @carrickjason we would definitely take a PR for this! |
I think there a two separate bugs we need to think of this as here:
|
I think I'd like to claim this. Thanks! |
Awesome! |
I've looked into this a bit, but forgot to update the issue. The applicable code is: I'm guessing when |
Just brainstorming, I wonder if a good way to do that would just be to create a blank file immediately? Or we could just resolve to an empty string instead of rejecting (only if a 404). Either way, though, we would need to make sure this only happened during |
Agreed, but we should notify the user at least with a toast or something, "Created blank file "_data/entry.json", especially since it's a deviation from current behavior. In the future (like beyond 2.0), I'd like to see this pulled into validation and some kind of prompt like "The files listed below are in your configuration, but don't exist in your repo. Would you like to create them now?". But again, that's futuristic :) |
@erquhart So, I see two ways to fix this, then:
|
Not a deviation, I guess just a feature. I'd say load time only because the file may have been misspelled, so we should make it clear what happened. |
I don't get it. I just tried to create a file collection. I used the example code from the documentation, but it only shows "No entries". Now, in your issue description you say, the file has to be created by the developer. No mention of that in the documentation. And it's also not clear whether an empty file is enough or whether it needs the container the data structure with empty values. Anyway, can't get file collections working. |
@renestalder an empty file is enough if the format accepts an empty value as valid. e.g., a blank file is valid YAML, but not valid JSON, as JSON requires some kind of recognizable, non-empty value. If all files in your configuration exist in your repo, and contain valid values for the file type, the collection will work. |
Also, docs are now updated with this information, thanks for pointing out the gap. |
This has been partially fixed in #1093 -- if a file fails to load, all other entries in a collection will still work. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
closing as stale. Please comment if still relevant |
- Do you want to request a feature or report a bug?
Both? Not sure if what is happening is desired behavior.
- What is the current behavior?
If you add a file entry to a collection in the
config.yml
file without adding the file at the specified path, The CMS simply shows 'No Entries' for that collection. If you remove that file config, the rest of your entries show up as they should.- If the current behavior is a bug, please provide the steps to reproduce.
Add a file entry to a collection without adding the file in your fs.
- What is the expected behavior?
The docs are not clear that, in order to add an entry, you must also create the file yourself. I guess I assumed that it would because if you add an entry to a folder type collection, it adds/commits the file for you. On top of this, only seeing 'No Entries' under the collection in the CMS and not seeing anything in the browser console is confusing and made it difficult to debug.
- Please mention your CMS, node.js, and operating system version.
CMS version 1.0.1
Node version 9.2.1
OS: Mac OS High Sierra
I'm loving the CMS though and If I can provide any help on this, please let me know.
The text was updated successfully, but these errors were encountered: