[MGNLFE-370] Hello SaaS - Issue with navigation in SPA. Norsu data structure from legacy writer is not compatible with old navigation style Created: 16/Nov/22  Updated: 19/Dec/22  Resolved: 12/Dec/22

Status: Closed
Project: Magnolia Frontend Helpers
Component/s: None
Affects Version/s: None
Fix Version/s: 1.3.2

Type: Improvement Priority: Neutral
Reporter: Oanh Thai Hoang Assignee: Canh Nguyen
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 2d 6.5h Time Spent: 2d 6.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PNG File real-response-from-pagenav-rest.png     File response.json     PNG File travel-and-sub-page.png     PNG File travel-navigation.png    
Issue Links:
Relates
relates to MGNLREST-574 LegacyPageWriter in pages returns emp... Closed
dependency
depends upon PAGES-948 [Norsu] @path value in routeTemplate ... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLFE-374 Implement Sub-task Completed Canh Nguyen  
MGNLFE-375 Review Sub-task Closed Christopher Zimmermann  
MGNLFE-376 piQA Sub-task Closed Oanh Thai Hoang  
MGNLFE-377 QA Sub-task Completed Phong Le Quoc  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Epic Link: SaaS TPR - Project DevX
Sprint: DevX 25
Story Points: 3
Team: DeveloperX
Work Started:

 Description   

Note: This should be updated in the Hello SaaS starter project.

Step to reproduce

Expectation: See travel and contact in navigation

Actual: See area navigation instead  

 

pagenav_v1.yaml definition config example: 

$type: deliveryEndpoint_v2
includeSystemProperties: true
depth: 5
nodeTypeMappings:
  pages:
    $type: pagesResolver_v2 

 

 

Reference rest response execute from http://localhost:8080/container/.rest/delivery/pagenav/v1/website/travel response.json

 

A hint for not showing areas is config includeSystemProperties: false



 Comments   
Comment by Oanh Thai Hoang [ 16/Nov/22 ]

Maybe we still need one ticket for docu to mention about navigation approach when migrating jcr to norsu. Even config LegacyPageWriter in rest definition but it will not show the whole page tree as jcr delivery?

Comment by Christopher Zimmermann [ 16/Nov/22 ]

Is this something to be changed in the SPA libraries, or just in the demo projects?

Comment by Canh Nguyen [ 17/Nov/22 ]

No changes for SPA libraries, only demo projects.

Comment by Canh Nguyen [ 24/Nov/22 ]

We can apply the same approach for both JCR and Norsu by making 2 request:

  • fetch /{nodePath}
  • fetch /{nodePath}@nodes

With this approach, we can use the same code base.

This approach also requires MGNLREST-537 to be done for Norsu to work.

 

If we prefer to make only one request, then:

  • JCR: keep the current code
  • Norsu: query by @path 
@path[like]=/{sitePath}%25 

The returned data should be sorted on client side to be used.

NOTE: JCR delivery endpoint does not support querying by @path so we cannot apply this approach for JCR.

Comment by Christopher Zimmermann [ 24/Nov/22 ]

Should not the Legacy Writer return the same response as the JCR endpoint? Would that solve this issue? Is there some reason that the Legacy Writer response is not implementing the same response? Is it too difficult?

Can you please show somewhere a comparison of the response from the JCR delivery endpoint and the Legacy writer endpoint? I would like to understand the difference.

I started doing that here - but I think this is something different right?
https://wiki.magnolia-cms.com/display/DEVINT/2022-11+Delivery+Format

Maybe you could add it in a new table at the bottom of the page?

Overall I am OK with making 2 requests - but based on comments here I am concerned that the Legacy Writer is not compatible and will cause other problems with customers projects when they try to bring it to SaaS.

Comment by Canh Nguyen [ 24/Nov/22 ]

Should not the Legacy Writer return the same response as the JCR endpoint? Would that solve this issue? Is there some reason that the Legacy Writer response is not implementing the same response? Is it too difficult?

We can return the response like JCR by calling child nodes recursively until get the maximum depth. When fetch a node, it will get its child nodes, then a child node gets its child nodes until reach the max depth.

The different between JCR and Norsu that, on JCR, it call one time to get a node with its children. The children are its attribute. So it's possible to fetch a whole tree in one call. On Norsu, there are no children like that, we can get only one node.
 

Comment by Christopher Zimmermann [ 24/Nov/22 ]

By the way - https://jira.magnolia-cms.com/browse/MGNLFE-370 is now unblocked, so we can proceed with it.

To unblock this ticket - lets go with the 2 requests approach so that the same code is used on SaaS and DXCORE.
Please create a followup ticket to reseach how we can achieve the desired content in one request.
In the code please include a comment with a link to the new ticket and a brief sentance why it is the way it is.

Comment by Christopher Zimmermann [ 28/Nov/22 ]

canh.nguyen  we have agreed on this approach:

  • fetch /{nodePath}
  • fetch /{nodePath}@nodes

But now I am wondering - what do you need "fetch /{nodePath}" .. did the SPA not alreadyu fetch that to get the page information? Could that not be reused so that for the navigation - only "fetch /{nodePath}@nodes" is required?

Comment by Canh Nguyen [ 29/Nov/22 ]

We cannot reuse it, the navigation should fetch the main page and its sub pages. When SPA renders a sub page, it's not the main page to be reused.

Comment by Christopher Zimmermann [ 29/Nov/22 ]

Thanks - I understand now.

Generated at Mon Feb 12 05:46:46 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.