Hello Magnolia Team,
we've run into another issue regarding personalization and caching.
(Last year i already opened a ticket under https://jira.magnolia-cms.com/browse/MGNLADVCACHE-94 with a similar problem).
In PersonalizedCacheStore#isPersonalized (or as well in PersonalizedCachePolicy#shouldCache) there's a visitor running to check the requested page node for any personalized components. The problem: The visited node is not wrapped with an InheritanceNodeWrapper, so any personalized components inherited from a parent page aren't visited which will of course break the cache since magnolia will treat this page as a normal page and not a personalized page (In this case, if a personalized page was cached first, all users after that will get the same personalized page displayed even if they don't match the traits).
I'll also provide an example:
On the project we currently have an "Overlay" Area inheriting components to all subpages. In this area we have a personalized component which should be displayed under certain conditions.
Hope this is somehow understandable
(right now it's not a time critical issue since we are still in the "experimental" phase)
Visiting the root page it's fine:
(Breakpoint in PersonalizedCacheStore#isPersonalized)
The component itself (correctly wraped with the variant):
Visiting a subpage:
(The personalized component is correctly displayed on the subpage)
This will lead to the method returning false and thus wrongly caching the page as a normal page.
I could also reproduce this on the current demo instance.
I already thought about possible solutions:
The most reasonable solution I came up with would be by modifying the visitor to wrap the visited nodes before visiting them by using DefaultInheritanceContentDecorator#wrapNode.
Maybe there are easier solutions to that issue or I'm missing here something
Thank you in advance for investigating the issue!
On behalf of AllSecur