aem-core-wcm-components icon indicating copy to clipboard operation
aem-core-wcm-components copied to clipboard

Default values for fields in image component dialog are not considered after drag&drop of asset on image component

Open henrykuijpers opened this issue 1 year ago • 2 comments

Bug Report

Current Behavior

  1. Configure the "Dynamic Media" functionality (namely the feature flag should be turned on to let the dialog fields render)
  2. Drag&drop an image component (v2, v3, ...) on the page
  3. Open the dialog, notice that the default values for the radiogroup field is taken into consideration
  4. Close the dialog without saving
  5. Drag&drop an asset on the image component (which triggers the cq:dropTargets functionality, which fills in the fileReference property)
  6. Open the dialog again
  7. Notice that the default values for the radiogroup field is not taken into consideration anymore

Expected behavior/code The default values for the dialog fields should be considered at all times: Those values are there for a reason of course.

Environment

  • AEM 6.5 SP17
  • Core Components 2.22.12
  • Java 11.0.16.1

Possible Solution Remove the "freshness" feature (or at least remove the 5msec "rule").

Additional context / Screenshots The problem appears to be in the "freshness"-feature of the TouchUI: The default mode is "CHECK_FRESHNESS", which does the following: It calculates the difference between the jcr:created value vs the jcr:lastModified value. If that difference is 5msec or less, then the values are considered "fresh" and the default values will be filled in. Otherwise, the default values will not be used and all fields will not show a default value (and thus show "no value", which of course is wrong).

It appears that a workaround is already in place in /libs/cq/gui/components/authoring/dialog/dialog.jsp for the "forms" feature:

        // for forms, we ignore freshness
        if(StringUtils.startsWith(dataPath, "/content/forms/af/")) {
            FormData.push(slingRequest, data.getValueMap(), NameNotFoundMode.IGNORE_FRESHNESS);
        } else {
            FormData.push(slingRequest, data.getValueMap(), NameNotFoundMode.CHECK_FRESHNESS);
        }

It also appears that it's impossible to change this behavior, the only component where this behavior can be changed is the "select" coral component, all the other components don't have that "forceIgnoreFreshness"-property that the "select"-component supports.

henrykuijpers avatar Jul 25 '23 14:07 henrykuijpers