enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
198 stars 34 forks source link

Save button remains enabled after content is saved #10558

Closed sgauruseu closed 1 month ago

sgauruseu commented 1 month ago

This issue is reproducing with the XP : https://repo.enonic.com/repository/dev/com/enonic/xp/enonic-xp-generic/7.14.2-SNAPSHOT/enonic-xp-generic-7.14.2-20240514.140829-23.zip

Case 1

  1. Open wizard for new site, fill in the name input
  2. Select SuperHero in applications.

BUG - Save/Saved button remains enabled after updating a site

image

Case 2

  1. Open wizard for new shortcut , fill in the name input
  2. Select a target - image , for example
  3. Click on Save button

BUG - Save/Saved button remains enabled after saving content

image

ashklianko commented 1 month ago

difference is in a property tree, if we send an update request for a shortcut content with this data:

[
    {
        "name": "target",
        "type": "Reference",
        "values": [
            {
                "v": "a0f4f654-82c5-4e56-9018-9ffe3f61c6ff"
            }
        ]
    },
    {
        "name": "parameters",
        "type": "PropertySet",
        "values": []
    }
]

then in previous XP version we get back:

[
    {
        "name": "target",
        "type": "Reference",
        "values": [
            {
                "v": "a0f4f654-82c5-4e56-9018-9ffe3f61c6ff"
            }
        ]
    },
    {
        "name": "parameters",
        "type": "PropertySet",
        "values": []
    }
]

and in the new XP version we don't get an empty "parameters" set:

[
    {
        "name": "target",
        "type": "Reference",
        "values": [
            {
                "v": "a0f4f654-82c5-4e56-9018-9ffe3f61c6ff"
            }
        ]
    }
]

thus we get a difference in a persisted content data and the rendered one where empty "parameters" set is present

rymsha commented 1 month ago

Strictly speaking it is a bug in frontend because in Java API there is no way to create a property without a single value. But frontend code managed to do so via PropertyArrayJson class where rules are broken via internal methods.

But this bug went too far and now we have a lot of values (including property-sets) saved without a value.

I have to introduce a public method to PropertySet to which allows to create property without a value

rymsha commented 1 month ago

We might have to deal with this complication later, when we need to assign UUID for each property value - since no value has no identity.