Skip to content

Changing writing locale cause uncaught type error #6307

@alvinsay

Description

@alvinsay

When writing a new post, changing locale will cause an uncaught type error and the editing form of the post content isn't show up.

To Reproduce

  1. Setup Netify CMS with i18n enabled.
  2. Click New button in the index page.
  3. Change writing locale dropdown from Writing in EN to another locale, for example, Writing in FR
  4. The editing form will disappear, and you will see an uncaught type error in the debug console.

Expected behavior

  • No error will be thrown.
  • The editing form won't disappear after changing the writing locale.

Screenshots

netify-cms-i18n

Applicable Versions:

  • Netlify CMS version: 2.*.*
  • Git provider: Self-hosted Gitlab
  • OS: MacOS
  • Browser version: chrome 99

CMS configuration

config.yaml

backend:
  name: gitlab
  repo: alvin/static-api-testbed # Path to your GitLab repository
  auth_type: pkce # Required for pkce
  app_id: #masked
  api_root: #masked
  base_url: #masked
  auth_endpoint: oauth/authorize
publish_mode: editorial_workflow
media_folder: "static/images/uploads"
public_folder: "static/images/uploads"
i18n:
  locales:
    - en
    - fr
  structure: "multiple_files"
  default_locale: en
collections:
  - name: "announcement" # Used in routes, e.g., /admin/collections/blog
    label: "Announcement" # Used in the UI
    i18n: true
    folder: "content/announcement" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}{{month}}{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
    fields: # The fields for each document, usually in front matter
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Featured Image", name: "thumbnail", widget: "image"}
      - {label: "Rating (scale of 1-5)", name: "rating", widget: "number"}
      - {label: "Body", name: "body", widget: "markdown"}

index.html

<!doctype html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Content Manager</title>
</head>

<body>
    <!-- Include the script that builds the page and powers Netlify CMS -->
    <script src="https://unpkg.com/netlify-cms@^2.10.187/dist/netlify-cms.js"></script>
</body>

</html>

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18ntype: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions