[MGNLPN-333] CookieFieldTransformer doesn't store values when multiple cookies are available Created: 21/Sep/16  Updated: 31/Jan/17  Resolved: 27/Jan/17

Status: Closed
Project: Magnolia Personalization
Component/s: Traits
Affects Version/s: 1.3
Fix Version/s: 1.2.9, 1.3.2, 1.4.2

Type: Bug Priority: Major
Reporter: Antti Hietala Assignee: Evzen Fochr
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File missing-value.png     PNG File two-cookies.png    
Issue Links:
causality
caused by MGNLUI-3715 Only values for selected options shou... 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
Sprint: Kromeriz 81
Story Points: 3

 Description   

CookieFieldTransformer extends SwitchableTransformer but it doesn't operate like a real switchable transformer. When two or more cookies are available in the cookies trait, such as in the travel demo, the CookieFieldTransformer only stores the first cookie's value and ignores the second cookie's value.

To reproduce in the travel demo:

  1. Select the "Which tour type are you?" component on the travel home page.
  2. Select the "Tour type is known" variant.
  3. Choose an audience for the variant. The variant already matches a cookie tourType=any. Add a second cookie weatherLocality=Basel. (see screenshot)
  4. Save the audience.
  5. In JCR Browser, open /travel/main/00/variants/variant-1/mgnl:ruleSet/voters.

Result:

  • Expected: Both cookies are stored as voters and both voters have a value stored in a cookieValue property.
  • Actual: Only the first cookie tourType has a value. The second cookie weatherLocality has no value in JCR.

If you change the transformer class of the cookies trait ruleField to a generic SwitchableTransformer, Magnolia stores both cookie values correctly but doesn't use the special property names cookieName and cookieValue.

I set the priority to major since this issue prevents you from using more than one cookie in the same variant.

Findings:
After changes in MGNLUI-3715, we delete property holding value for not selected switchable field option. But when we use same name for "cookieValue" property for all switchable field options, this property is deleted from related form item if we select not last select field option.


Generated at Mon Feb 12 06:36:36 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.