[MGNLUI-7030] Switchable field creates empty contentNodes for non selected option Created: 07/Feb/22  Updated: 10/Oct/22  Resolved: 10/Mar/22

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.16
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Rabie Hayoun
Resolution: Cannot Reproduce Votes: 0
Labels: nucleus
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
duplicate
is duplicated by MGNLUI-6505 Non-selected values are kept in switc... Closed
relation
is related to MGNLUI-6906 Switchable field doesn't keep the def... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: jcrChildNodeProvider creates nodes for unselected subforms
Team: Nucleus

 Description   

Steps to reproduce

  1.  Create a component as follows:
    form:
      properties:
        - name: text
          i18n: true
          required: true
          $type: textField
        - name: switchMe
          $type: switchableField
          i18n: true
          field:
            $type: radioButtonGroupField
            layout: horizontal
            defaultValue: internal
            datasource:
              $type: optionListDatasource
              options:
                - name: internal
                  value: internal
                - name: external
                  value: external
          itemProvider:
            $type: jcrChildNodeProvider
          forms:
            - name: internal
              properties:
                internal:
                  $type: pageLinkField
            - name: external
              properties:
                external:
                  $type: textField
  1.  Within a multi-language site, include the component in a page
  2. Open the component (default language, e.g, EN) and select something on the switchable
  3. Save the component, open it and check everything is as expected (value is checked)
  4. Switch to another language (e.g, DE) and check the radio button has no option selected (this is not true anymore, defaults works in all languages now)
  5. Fulfill the textfield and save the component
  6. Go to JCR, open the page which has this component, and check that a contentNode named switchMe_de has been created tho it has no properties.

Expected results

switchMe_de contentNode is created if it gets selected at the dialog

Actual results

switchMe_de contentNode is created even if it is not selected by the user

Workaround

N/A

Development notes

This is a problem as far as when the FTL is rendered and checks that the node exists, it will try to read the properties (on this case, it will try to read the attributes to generate the proper link) which will cause nullPointers and will break the template.



 Comments   
Comment by Adam Siska [ 23/Feb/22 ]

Discovery completed

ad 5) [...] and check the radio button has no option selected
^ this is not true anymore, thus node is created with one property field with value internal

Anyway, if we remove defaultValue configuration from radioButtonGroup, node for switchable content is created once language is selected in dialog (see MGNLUI-5736, already estimated 8SP)

alternative reprosteps:
1) unhide and open contacts-v8 app
2) edit contact (don't make any changes)
3) switch language to German
4) save detail sub app
Observe that empty nodes switchable and switchable_de are created.

Comment by Dominik Maslanka [ 10/Mar/22 ]

ccantalapiedra solution on this topic will be provided within this ticket https://jira.magnolia-cms.com/browse/MGNLUI-5736 - i'm closing this one. 

Generated at Mon Feb 12 09:42:26 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.