My Java DXA application renders dynamic component presentations across the site, similar to 'Teaser' functionality in the Reference implementation of DXA.
One of the Rich text field of DCP contains component (links) which are used on more than one page. So I'm expecting Tridion dynamic linking to resolve links to the 'closets' page using proximity logic(see docs: https://docs.sdl.com/783502/395189/sdl-tridion-sites-9-1/component-link-resolving-logic).
However, links are not resolved as I expected as it is ignoring the page context. Initially, I thought it is a DXA issue similar to the earlier reported one with the static CPs: https://github.com/sdl/dxa-web-application-java/issues/104.
After doing some more investigation, I seems that it is not necessarily a DXA issue but a issue with GraphQL api itself (which is used by DXA ContentProvider).
As GraphQL query which deals with component presentations doesn't accept 'page context/id' at all.
componentPresentation(
namespaceId: Int!
publicationId: Int!
componentId: Int!
templateId: Int!
contextData: [InputClaimValue]
)
Whereas CIL API seems to take page id into account as you could invoke ComponentPresentationAssembler
with it:
ComponentPresentationAssembler cpa = new ComponentPresentationAssembler(publicatinId, pageId);
String result = cpa.getContent("tcm:5-3716", "tcm:5-3718-32");
I am wondering is it a issue with GraphQL api or am I missing something?
Any thoughts?