Comments (8)
@niekraaijmakers what do you mean by using ACS aem commons? any news on this issue? I don't understand why this issue got closed... this is a very important issue.. many clients use a breadcrumb at template level.
from aem-sample-we-retail-journal.
Agreed, @cqsapient I have seen inconsistencies with resolving the "currentPage" with the SPA implementation. I believe this is due to how the JSON gets generated via the HiearchyPageImpl model. The JSON gets collected for multiple depths but in cases like this the correct context gets lost.
Question for you, if you request the exact path of your page i.e /content/spa/root/mypage.model.json
vs /content/spa/root.model.json
do you get the expected value?
from aem-sample-we-retail-journal.
Thanks for replying @godanny86
Yes, as you mentioned, the issue is only in /content/spa/root.model.json
when using the .model selector in any other page; say /content/spa/root/mypage.model.json
currentPage is properly initialized.
This is because HiearchyPageImpl model comes into picture only when root.model.json is requested; I tried debugging it and found that the debugger does not go to HiearchyPageImpl when .model json is appended in any other page. I know that HiearchyPageImpl is causing this issue; it is setting the attribute -CURRENT_PAGE_ATTR on the wrapper SlingRequest in these lines.
wrapper.setAttribute(COMPONENT_CONTEXT_ATTR, new HierarchyComponentContextWrapper(componentContext, hierarchyPage));
wrapper.setAttribute(CURRENT_PAGE_ATTR, hierarchyPage);
I tried commenting these lines and deployed the code; but still it did not fix the issue.
It will be helpful that the engineering team of AEM SPA module looks into it and provides a resolution so that we are able to utilize all capabilities of the powerful editable templates feature of AEM sites; as it is not possible to use currentPage if the component needs to be locked down in the template.
from aem-sample-we-retail-journal.
Hi, by default the referenced page used by the injector is only set once per request from the entry point. If your entry point is /content/spa/root.model.json
, the resource relative to root
will be the current page. As in the context of the HiearchyPageImpl
we want to list a tree of pages, we updated the ComponentContext
with the expected current page. This workaround could be avoided if we improve or provide a dedicated injector
My questions to you are:
- Does what you call the last created page correspond to the entry point of the request?
- At which level of the hierarchy of pages is this issue occurring - 0 (First use of the HierarchyPage), 1 (First child HierarchyPage), >=2 (sub-children and leaves)?
- Could you please add a breakpoint where we override the
COMPONENT_CONTEXT_ATTR
and observe if thehierachyPage
variable contains the expected value?
from aem-sample-we-retail-journal.
I have a similar issue. I'm trying to write react version of Breadcrumb component from core components and for each page the number of items is the same. It looks like the breadcrumb items are being generated only for the last page in :children property from root model.json. I believe this is the 'last created page'.
I debugged the hierarchyPage and it changes accordingly for each page, but when I had a look at currentPage in BreadrumbImpl model, the value was not the expected one.
A quick workaround could be
currentPage = request.getResourceResolver().adaptTo(PageManager.class).getContainingPage(resource)
instead of
@ScriptVariable
private Page currentPage;
from aem-sample-we-retail-journal.
I recall having to work around that very same issue. That said, the problem relates neither to the current project nor the SPA Editor feature but to the overall AEM/Sling Dependency Injection and Binding Framework. Would be best to open a ticket either via AEM Customer Care or Sling depending on the assumption as to where the issue is located. I have to admit that I haven't investigated the location of the underlying issue
from aem-sample-we-retail-journal.
Was this fixed? I'm still having breadcrumb issue with currentPage.
from aem-sample-we-retail-journal.
I believe we should use resourcePage for this context. That is much more robust then currentPage.
Of course that requires ACS aem commons I believe ...
from aem-sample-we-retail-journal.
Related Issues (20)
- Update to latest Core Components & 6.4 UberJAR
- Support Server-side rendering requests for Template page paths HOT 1
- App doesn't work on IE 11 HOT 2
- React app does not load on publish instance due to HierarchyPageImpl HOT 6
- Support AEM 6.2 HOT 1
- AEM REACT multifield Component. HOT 17
- javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake HOT 1
- Vue.js support HOT 2
- Cannot serve request to /libs/wcm/core/content/pageinfo.json in com.day.cq.wcm.core.impl.servlets.PageInfoServlet HOT 3
- MapTo - @adobe/cq-react-editable-components HOT 6
- Getting window is not defined on my own project HOT 2
- 403 error with CustomModelClient HOT 1
- How to pass parameters in URL
- SSR functionality is not working HOT 8
- SSR for experience fragments HOT 4
- apixu weather forecast end point is broken HOT 1
- PKIX path building failed when using SSR by https HOT 1
- Meaning of AppPage HOT 1
- Frontend app build fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aem-sample-we-retail-journal.