Skip to content
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

Relation widget creates empty merge requests that crashes the editorial workflow #7142

Open
LHSnow opened this issue Mar 12, 2024 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@LHSnow
Copy link

LHSnow commented Mar 12, 2024

When editing a page, having the i18n pane open enables the save button even if nothing has changed. If the user presses the save button (which they naturally do thinking they've unsaved content) before making any actual changes, an empty merge request is created, which crashes the editorial workflow screen with a 404 error.

To Reproduce

  1. Configure cms as below
  2. Edit a page with a relationship to another collection
  3. In a short moment, the state of the save button changes from 'saved' to 'unsaved content'
  4. Click the save button
  5. Empty merge request is posted (to gitlab backend)

Expected behavior

Save button should stay disabled until there is meaningful changes to save.

Applicable Versions

  • Decap CMS version: 3.1.10
  • Git provider: Gitlab
  • OS: Ubuntu 22.04.4 LTS
  • Browser version: Firefox 123.0.1, Chrome 122.0.6261.94

CMS configuration

Slightly redacted for brewity and security.

backend:
  name: gitlab 
  auth_type: pkce 
  auth_endpoint: oauth/authorize
  branch: master
  commit_messages:
    create: "Create {{path}} by {{author-login}}"
    update: "Update {{path}} by {{author-login}}"
    delete: "Delete {{path}} by {{author-login}}"
    uploadMedia: "Upload {{path}} by {{author-login}}"
    deleteMedia: "Delete {{path}} by {{author-login}}"

i18n:
  structure: multiple_files 
  locales: [ sv, en ]
  defaultLocale: sv 
  
collections:
  - name: 'staff'
    folder: content/staff
    media_folder: '/{{media_folder}}'
    public_folder: ''
    i18n: true
    create: true
    delete: true
    fields:
      - label: 'Name'
        name: 'title'
        widget: 'string'
        i18n: 'duplicate'
        required: true
      - label: 'Presentation'
        name: 'body'
        widget: 'markdown'
        i18n: true
        required: false
  - name: 'organisation'
    folder: 'content/organisation'
    media_folder: '/{{media_folder}}'
    public_folder: ''
    i18n: true
    create: true
    delete: true
    summary: "{{dirname}}{{dirname | ternary('/','')}}{{slug}}"
    path: "{{dirname | ternary('/','')}}{{dirname}}{{dirname | ternary('/','')}}{{slug}}"
    fields:
      - label: 'Title'
        name: 'title'
        widget: 'string'
        i18n: true
      - label: 'Content'
        name: 'body'
        widget: 'markdown'
        required: false
        i18n: true
      - label: 'Author'
        name: 'author'
        widget: 'relation'
        collection: 'staff'
        # The bug is reproducible for all allowed values i18n
        i18n: 'duplicate'
        value_field: 'title'
        multiple: false
        required: true
@LHSnow LHSnow added the type: bug code to address defects in shipped code label Mar 12, 2024
@LHSnow LHSnow changed the title Relation widget reports changed content when i18n view is open, without touching anything Relation widget creates empty merge requests that crashes the editorial workflow Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant