Skip to content

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

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

Open
EthanLMartin opened this issue Apr 16, 2025 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@EthanLMartin
Copy link

EthanLMartin commented Apr 16, 2025

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

@EthanLMartin EthanLMartin added the type: bug code to address defects in shipped code label Apr 16, 2025
@EthanLMartin EthanLMartin changed the title Markdown widgets do not update the parent correctly when used inside lists Markdown widgets sometimes update the wrong parent object when used inside lists Apr 17, 2025
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