adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
743 stars 750 forks source link

[Teaser] Changes to Title not stored if you edit actions tab before saving #781

Closed MarkHorman closed 5 years ago

MarkHorman commented 5 years ago

Bug Report

Current Behavior I am overlaying the Core Teaser component with resourceSuperType=core/wcm/components/teaser/v1/teaser.

Add details for the Teaser and save. Go back in to edit the Teaser and modify the Title, navigate to the actions Tab and edit the CTA label, Save/close the dialog. Notice that the change to the Title was not saved and updated, but only the CTA label.

Expected behavior/code I would expect any/all changes made inside the Teaser Dialog to be saved regardless of how many changes are made on each tab.

Environment

richardhand commented 5 years ago

Hi @MarkHorman, I've been unable to replicate this on 6.4.4 with Core Components 2.1.0 (the version with which the teaser was released), nor on the latest version of the Core Components. Could you please post the correct version of the Core Components you are seeing this issue with?

Also consider updating to the latest release (2.7.0) - there was a similar issue fixed there: https://github.com/adobe/aem-core-wcm-components/issues/719

Thanks :)

MarkHorman commented 5 years ago

Apologies @richardhand , that should have read Core Components version = 2.5.0. Updated Ticket, however in the mean time I'll have a look at 2.7.0 to see if I can replicate the issue

MarkHorman commented 5 years ago

@richardhand Issue repeatable on core Teaser 2.7.0

teaser.mov.zip attached a video to illustrate the issue. As it turns out as soon as I modify the CTA label, the title is being reset to it's previous value.

Step 1: modify Teaser Title Step 2: click Actions Tab and change the CTA label Step3: click back Text Tab....notice the Title has reverted to previous unedited value.

andreeadracea commented 5 years ago

@MarkHorman, I was also able to reproduce the problem with 6.4.4.0 and 2.7.0 but it seems that it didn't use the last implementation of the checkboxTextfieldTuple.js which solved the issue. After deleting my browser cache I was not able to reproduce the problem anymore. Could you please try it again after deleting your cache and let me know if it works ok also for you?

MarkHorman commented 5 years ago

@andreeadracea problem persists after clearing the cache.

looks to me that retrievePageInfo method in clientlibs/editor/js/teaser.ts is retrieving the Title here titleTuple.seedTextValue(data["jcr:title"]); but as I haven't yet saved the changes to title before changing tabs it's reverting to the previously stored value.

andreeadracea commented 5 years ago

@MarkHorman, the commit which solve the problem is https://github.com/adobe/aem-core-wcm-components/commit/d8e4c986b8fe384a4b2bc6734c8549d337797708 and the solution was released on 2.7.0.

Could you please check if this code was added to your instance to this js file (/apps/core/wcm/components/commons/v1/clientlibs/editor/checkboxTextfieldTuple/checkboxTextfieldTuple.js)?

self._textfield.addEventListener("change", function() { self._textfield.setAttribute(self.ATTR_PREVIOUS_VALUE, self._getTextfieldValue()); });

Also, could you please check also on your browser if this js file was updated?

MarkHorman commented 5 years ago

@andreeadracea confirm that code exists at line 77 on my instance and also confirm that the file in browser cache has the same. However, I'm not following why you think the checkboxTextfieldTuple is related? I haven't touched any checkbox since creating the initial teaser content when I enabled the CTA. This is only about editing Text.Title, and CTA.Title at the same time, the Text.Title is being reverted after edit of the CTA.Title. BTW I added a breakpoint at the code you mentioned above, it is never hit during the actions mentioned below.

Issue persists:

  1. on Text Tab, modify the Title field (note, I DO NOT have "Get Title from linked page" checked)
  2. navigate to Actions Tab, modify the CTA Title/label
  3. return to Text tab, Title field has reverted to previous value
andreeadracea commented 5 years ago

Hi @MarkHorman, I've retested with the scenario you described with Core Components 2.7.0 and everything worked ok for me. With Core Comp. 2.5.0 I could reproduce your issue.

I've attached a screen recording with the steps I did in order to reproduce your scenario.

Teaser1.mov.zip

MarkHorman commented 5 years ago

@andreeadracea I created a new AEM instance and retested this. Agree core 2.7 resolves this issue. Seems my existing instance had become corrupted somehow and the install of 2.7 had failed to update correctly. Closing this issue