A full-featured, open-source content management framework built with Node.js that empowers organizations by combining in-context editing and headless architecture in a full-stack JS environment.
When validating relationship fields, if there withRelationships and builders.project are set, add needed idsStorage fields to project in order to be able to retrieve sub relationship.
New behavior
If withRelationships is set to \true we take all first level relationships,
In this case if the default-page has relationships to foodArticles and sportArticles, it will incluce both.
But if foodArticles has a relationship to topics, it won't take it.
this behavior already worked but was not documented, I just made sure it still works with missing projections.
If withRelationships is an array with one or multiple levels of relationships using the dot notation. for each one having a projection, we add the missing fields to build these relationships.
In this case we will get pages, their articles and the topics of the articles. Even if the projections on each level do not include the needed relationship properties.
⚠️ It might change some existing behavior since if relationship is not explicitly false we take the first level of relationship even if the projection does not include the right field. I would argue that it's not a problematic change since it's the normal behavior when no projection.
What are the specific steps to test this change?
See Ticket description:
Create widget with relationship to a page
create piece
add relationship from page to piece
In widget, if a project is added to page (even without idsStorage for the sub relationship) it should work.
It reproduces the behavior described in the ticket.
What kind of change does this PR introduce?
[X] Bug fix
[ ] New feature
[ ] Refactor
[ ] Documentation
[ ] Build-related changes
[ ] Other
Make sure the PR fulfills these requirements:
[X] It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
PRO-6535
Summary
When validating relationship fields, if there
withRelationships
andbuilders.project
are set, add neededidsStorage
fields to project in order to be able to retrieve sub relationship.New behavior
If
withRelationships
is set to\true
we take all first level relationships,In this case if the
default-page
has relationships to foodArticles and sportArticles, it will incluce both. But if foodArticles has a relationship to topics, it won't take it. this behavior already worked but was not documented, I just made sure it still works with missing projections.If
withRelationships
is an array with one or multiple levels of relationships using the dot notation. for each one having a projection, we add the missing fields to build these relationships.In this case we will get pages, their articles and the topics of the articles. Even if the projections on each level do not include the needed relationship properties.
⚠️ It might change some existing behavior since if relationship is not explicitly false we take the first level of relationship even if the projection does not include the right field. I would argue that it's not a problematic change since it's the normal behavior when no projection.
What are the specific steps to test this change?
See Ticket description:
If you don't want to spend time configuring a project to test it, I created a branch for you: https://github.com/ValJed/a3-wp/tree/pro-6535-projections-sub-relationships
It reproduces the behavior described in the ticket.
What kind of change does this PR introduce?
Make sure the PR fulfills these requirements: