Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-6905

Complex fields (new UI) creates empty contentNode at JCR for each language

XMLWordPrintable

    • Yes
    • UI Maintenance 1, UI Maintenance 2
    • 5

      Steps to reproduce

      1.  Create a multiValue which has 18n enable, like this:
        myDialog.yaml
        label: Events List
        form:
          properties:
            events:
              $type: jcrMultiField
              i18n: true
              label: Events
              itemProvider:
                $type: jcrChildNodeProvider
              field:
                $type: compositeField
                properties:
                  title:
                    label: title
                    $type: textField
                  date:
                    label: date
                    $type: dateField
      1.  Create the component
      2. Save data only in English
      3. Check at JCR that a mgnl:contentNode (empty) has been created for all available languages

      Expected results

      Only those nodes of language to which was switched are created. Node for default language is created every time.

      Actual results

      For each language, a mgnl:contentNode is created, even if the user didn't create (add) any field at the dialog for that language

      Workaround

      Use the old UI dialog definition (for this case, if you use this you can check the behavior):

      my_old_dialog_definition.yaml
      form:
        tabs:
          - name: tabText
            label: Multivalue composite
            fields:
              - name: events
                fieldType: multiValue
                i18n: true
                label: Events
                transformerClass: info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer
                field:
                  name: compositeField
                  fieldType: composite
                  transformerClass: info.magnolia.ui.form.field.transformer.composite.NoOpCompositeTransformer
                  fields:
                    - name: title
                      fieldType: text
                      label: Title
                    - name: date
                      fieldType: date
                      label: Date
      
      actions:
        commit:
          class: info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
        cancel:
          class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition
      

      Development notes

      On Magnolia 5.7, only those fields which had been added to a language were saved, otherwise they weren't created (please check the attachments)

      This behavior affects on first place to performance for users which have lots of languages enabled on a site and, on second place, if working with nodes/delivery api. On that second case, if you perform a REST call to get the nodes for that component you may get (following the Events example) that there are 10 events in 10 different languages when really only English has events and the other 9 are empty nodes that were created because this bug.

        Acceptance criteria

              asiska Adam Siska
              ccantalapiedra Carlos Cantalapiedra
              Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD