Skip to content

Markdown widgets sometimes update the wrong parent object when used inside lists #7458

@EthanLMartin

Description

@EthanLMartin

Describe the bug
When a markdown widget is used inside a object, and that object is used within a list, updating the markdown field will sometimes update the wrong entry inside the list.

To Reproduce

  • Add two objects to a list, where the second one contains a markdown widget
  • Remove the first object from the list
  • Update the markdown within the remaining field
    • There is now an extra object in the list, that cannot be removed within the UI, and needs the JSON file to be directly modified
  • Publish content
    • There is now an extra object in the list only consisting of the markdown value that got updated

Expected behavior
The markdown should update the correct object.

Screenshots
UI resulting from this behaviour:
Image

Resulting JSON output:
Image

Applicable Versions:

  • Decap CMS version: 3.6.2
  • Git provider: GitLab
  • OS: All
  • Browser version: All
  • Node.JS version: 20

CMS configuration

local_backend: true
backend:
  name: test-repo
media_folder: static/images
public_folder: /images
collections:
  - label: Example Page
    name: example-page
    folder: data/example-page/
    create: true
    delete: true
    extension: json
    fields:
      - name: name
        label: Name
        hint: ''
        widget: string
        required: true
        default: ''
      - name: content
        label: Content
        widget: list
        types:
          - name: exampleObject
            label: Example Object
            widget: object
            summary: Example Object
            fields:
              - name: markdownText
                label: Markdown Text
                widget: markdown
                hint: ''
                buttons:
                  - bold
                  - italic
                  - link
                  - heading-one
                  - heading-two
                  - quote
                  - bulleted-list
                  - numbered-list
                required: false
                default: ''
            collapsed: true
          - name: otherExampleObject
            label: Other Example Object
            widget: object
            summary: Other Example Object
            fields:
              - name: markdownTextOther
                label: Markdown Text
                widget: markdown
                hint: ''
                buttons:
                  - bold
                  - italic
                  - link
                  - heading-one
                  - heading-two
                  - quote
                  - bulleted-list
                  - numbered-list
                required: false
                default: ''
            collapsed: true
    collapsed: true
    identifier_field: name
    summary: '{{fields.name}}'

Additional context
This occurs if the markdown's parent object is moved at all within the list. The only way to get around this is to refresh the page after the parent object is moved.
I've tried this with a few other widgets and it's only the markdown that appears to have this behaviour

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: 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