adobe / aem-spa-page-model-manager

Interface between Adobe Experience Manager and Single Page Application framework.
Apache License 2.0
35 stars 24 forks source link

[bug] In Publish servers, Home model.json is not being fetched and populated on SPA sites #101

Open AChris07 opened 1 year ago

AChris07 commented 1 year ago

Describe the bug With SPA client-side routing implemented, on a Published page, any time a user tries to navigate to the current site's Home path ("/", ie. https://www.example.com/) from any other given page, the model.json is not fetched, causing the page to go blank.

Package version 1.3.11

To Reproduce

  1. Populate a given page in a site with a Link (ie. via a custom component)

  2. Publish the site

  3. Navigate to said page

  4. Try to use the Link to redirect to Home

Expected behavior The .model.json should be fetched, and the page correctly populated with the Home page content

Actual behavior The .model.json file is never fetched, and the page goes blank

Screenshots Will be adding these shortly.

Additional context Based on our initial investigation, it seems this might be explicitly set, as shown here: https://github.com/adobe/aem-spa-page-model-manager/blob/948895dc1077e734d23848cc13eadad9a2c68ca1/src/ModelRouter.ts#L174-L179

However, there's no context on why that is, and this seems to be a common enough use-case that should be supported.

nitin2io commented 11 months ago

Any update on how to tackle this problem? We are also facing this problem when we started URL shortening and for homepage when accessing with '/' it is behaving differently. Is there a way if we can override ModelRouter.ts so that it handle the browser path with '/' ?

AChris07 commented 3 months ago

@nitin2io A bit of a delayed response, but we've ended up setting the home page as /home and using a redirect. That side-stepped the issue and has worked great so far. It'd be great to get some more context on why it's not supported however.