Open lukeocodes opened 4 years ago
This error occurred in these other issues (#4327 #3772 #3690) but based on the config and the lack of errors I couldn't be sure if related. They're all closed without resolution too.
Yes, this error seems to be related only to creating new content without entering all translations.
Versions:
app.js
// This global flag enables manual initialization.
window.CMS_MANUAL_INIT = true
import CMS from 'netlify-cms-app'
import { pages } from './collections/pages'
CMS.init({
config: {
load_config_file: false,
local_backend: true,
media_folder: '/static/meda',
public_folder: '/meda',
backend: {
name: 'git-gateway'
},
media_library: {
name: '',
config: {
max_file_size: 700000
}
},
i18n: {
structure: 'multiple_files',
locales: ['nl', 'en', 'de'],
default_locale: 'nl'
},
collections: [pages]
},
})
Pages collection
import { image } from "../partials/image"
const fields = [
{
label: 'Title',
name: 'title',
widget: 'string',
required: false,
i18n: true
},
{
label: 'Url',
name: 'url',
widget: 'string',
required: false,
i18n: true
},
image
]
const pages = {
label: 'Pages',
name: 'pages',
create: true,
i18n: true,
media_folder: 'images',
public_folder: 'images',
format: 'frontmatter',
path: '{{slug}}/index',
editor: {
preview: false
},
folder: 'content/pages',
fields: [
...fields
],
}
export {
pages
}
Image
label: "Image",
name: 'image',
widget: 'object',
i18n: true,
fields: [
{
label: 'Source',
name: 'source',
widget: 'image',
required: false,
i18n: true
},
{
label: 'Alt text',
name: 'alt',
widget: 'string',
required: false,
i18n: true
},
]
}
Error on creating page
netlify-cms-app.js:167 Uncaught (in promise) TypeError: Cannot read property 'get' of undefined
at eval (netlify-cms-app.js:167)
at eval (netlify-cms-app.js:1)
at it.__iterate (netlify-cms-app.js:1)
at it.reduce (netlify-cms-app.js:1)
at s (netlify-cms-app.js:167)
at t.serializeValues (netlify-cms-app.js:167)
at r (netlify-cms-app.js:34)
at eval (netlify-cms-app.js:43)
at Array.forEach (<anonymous>)
at t.serializeI18n (netlify-cms-app.js:43)
Let me know if you need anything else, happy to help :)
Hi @lukeocodes, did you manage to solve this issue or find a workaround ?
I cannot save any records and setting fields as required: false, default: ""
doesn't help.
Seemed to me to be a limitation of i18n, to assume there is always a translation
It's a big limitation in some situations, limitation which isn't written anywhere in the doc, and presents itself as a bug to the users.
Basically with i18n all the fields become mandatory and for every language.
With a dozen languages to translate and many keys in each document there is no way to save a draft after editing a subset of them.
It feels like it's the required: false
option that doesn't work.
This bug appears even when all the fields are optional.
Describe the bug
I have enabled i18n for content authoring. I believe I should be able to save a post in the primary language without adding all the translations at the same time. When I try to save, I get no visible error. Instead, I get this error in the console.
To Reproduce
/admin
Expected behavior
/admin
Screenshots
Applicable Versions:
CMS configuration
https://github.com/Nexmo/deved-platform/blob/i18n-netlify-cms/static/admin/config.yml
Additional context
If I complete all the fields for all the languages, it then lets me save!