-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component without content policy gets style from previous component with policy #47
Comments
In case it's relevant, my resource of type B is at a child path of my resource of type A /content/parent of type A When creating the model for |
hmm ... this Design/getCurrentDesign code is there for backward compatibility for the very old CQ times (before template editor). maybe it's not fully correct. does the problem only occur for two resource types with a parent/child relation as you described? can you come up with a PR with a test case that reproduces the problem? |
Playing around with it a bit more, it appears that the issue only happens if the |
i'm wondering if this use case behaves differently in a real AEM instance? afaik the on the other hand there seems to be a change in AEM behavior related to this fallback to the old "design" mechanisms: |
if |
can you come up with a PR containing a test case the reproduces the problem? |
I wish I could spend the time, but unfortunately I cannot. I was able to work around the issue by ensuring my If this issue is simply "yep, it's an issue, but no one has time to fix so we're going to close" I understand. |
If I call
io.wcm.testing.mock.aem.context.AemContextImpl#contentPolicyMapping
with resourceType A, and then later in my test I construct a model of resourceType B that does not have a content policy, thecurrentStyle
script variable for model B is injected with the style policy I set for resourceType A.I ran the debugger and here's what I can see happening. In
io.wcm.testing.mock.aem.context.MockAemSlingBindings#getStyle
we have the following code:What happens is the
ContentPolicy
for resourceType B ends upnull
(correctly) and the code falls back tocurrentDesign
, which then callscurrentDesign.getStyle(wcmComponentContext.getCell());
Inside of
io.wcm.testing.mock.aem.MockDesign#getStyle(Cell)
we have the following code:cell
is indeed an instance ofMockCell
, and theresource
evaluates to my resource of resourceType A, which then causes the Style for resourceType A to be returned.The text was updated successfully, but these errors were encountered: