[MGNLUI-4205] Setting "selected" is true in Select field doesn't work in case of existing item Created: 08/May/17  Updated: 03/Aug/17  Resolved: 09/May/17

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 5.4.12, 5.5.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Oanh Thai Hoang Assignee: Unassigned
Resolution: Not an issue Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Rename-contact.png     PNG File Select-field-configuration.png    
Issue Links:
Relates
relates to MGNLUI-4264 Switchable Field default selection do... Closed
causality
caused by MGNLUI-4113 "selected" property is ignored for ne... 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:

 Description   
Step to reproduce:
  • Import file to /modules/ui-framework/dialogs/rename/form/tabs/item/fields
  • Open Contacts app
  • Choose one item and select Rename contact

Observation: Select field doesn't select Test 1
Expectation: Test 1 must be selected

Source of problem

Since code was introduced from MGNLUI-4113

    public void setPropertyDataSourceAndDefaultValue(Property property) {
        this.field.setPropertyDataSource(property);

        if ((item instanceof ItemAdapter && ((ItemAdapter) item).isNew() && property.getValue() == null) || (!(item instanceof ItemAdapter) && property.getValue() == null)) {
            setPropertyDataSourceDefaultValue(property);
        }
    }

so in case of item is existed like contact item, #setPropertyDataSourceDefaultValue will never call



 Comments   
Comment by Mikaël Geljić [ 09/May/17 ]

default values are only applied when the item is new

As I wrote on MGNLUI-4113, this still stands.

What would happen if we applied default values for existing items?
Authors could open the dialog, see the default value, and decide to simply close/cancel the dialog—without realizing that value is not saved.

By renaming a contact, you are opening a dialog with a pre-existing item.

It does not matter if the dialog definition changed.
Generally, when modifying dialog definitions, it might be a good idea to combine that with a new delta task, in the version handler; or at least with a groovy script.

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