[MGNLUI-5327] Switchable field won't remove a previously persisted property when saving the second time around Created: 15/Aug/19  Updated: 05/Mar/21  Resolved: 05/Mar/21

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

Type: Bug Priority: Neutral
Reporter: Federico Grilli Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screenshot 2019-08-16 at 13.02.21.png    
Issue Links:
duplicate
is duplicated by MGNLUI-6505 Non-selected values are kept in switc... 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

 Description   

Switchable field won't remove a previously persisted property when saving the second time around or more.

Ideally the save operation should just re-create the node in such case and not manually dig into which property to keep and which to remove.

To reproduce use this configuration, for instance

switchable:
          label: switchable
          class: info.magnolia.ui.field.ConfiguredSwitchableFieldDefinition
          field:
            $type: radioButtonGroupField
            datasource:
              $type: optionListDatasource
              options:
                - name: foo
                  value: foo
                - name: bar
                  value: bar
          itemProvider:
            $type: fetchJcrSubNodeProvider
          forms:
            - name: foo
              properties:
                foo:
                  label: foo
                  $type: textField
            - name: bar
              properties:
                bar:
                  label: bar
                  $type: richTextField

This is how data looks like in JCR after having first chosen bar and then foo. The ideal behavior would be to just have the latest saved value, foo in this case


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