[MAGNOLIA-6821] Selectors are not cleared on FORWARD or INCLUDE Created: 18/Oct/16  Updated: 10/Nov/16  Resolved: 05/Nov/16

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: 5.5

Type: Task Priority: Neutral
Reporter: Roman Kovařík Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by MSITEMESH-49 Remove workarounds for MAGNOLIA-6821 ... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Sprint: Kromeriz 69
Story Points: 3

 Description   
  1. Request http://localhost:8080/magnoliaPublic/demo-project~mgnlArea=branding,metaNavigation~ sets selector to mgnlArea=branding,metaNavigation and also sets context attribute mgnlArea=branding,metaNavigation.
  2. A subsequent forward or include without a selector (http://localhost:8080/magnoliaPublic/demo-project/stage/component) does:
            if (StringUtils.isNotEmpty(selector)) {
                selectors = this.selector.split(Path.SELECTOR_DELIMITER); //selectors are not assigned, it keeps mgnlArea=branding,metaNavigation 
            }
            for (String sel : selectors) {
                ...
                MgnlContext.setAttribute(splitSelector[0], splitSelector[1]); //mgnlArea=branding,metaNavigation is set incorrectly
                ...
            }
    

    info.magnolia.cms.core.AggregationState#setSelector should not set the previously set selectors if the current selector is empty and could possible also clear the attributes set by the previous selector.



 Comments   
Comment by Jan Haderka [ 31/Oct/16 ]

why is this an issue? Can you provide example showing when/where this causes unexpected results?

Comment by Roman Kovařík [ 31/Oct/16 ]

I have a page with dynamic area and a dynamic component.
We use forwards for fragment requests since MSITEMESH-13.

  1. The dynamic area is requested with the selector mgnlArea=areaName.
  2. The dynamic component is requested with its path (/page/area/component) and it tries to render an area areaName in the path since the selector stays the same (and it shouldn't since the URI is different) from the previous forward. That area doesn't exist so it results in 404.
Generated at Mon Feb 12 04:18:09 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.