Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AChris07 opened this issue May 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@AChris07
Copy link

AChris07 commented May 8, 2023

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:

// don't fetch the model
// for the root path
// or when the route is excluded
if (!path || ('/' === path) || isRouteExcluded(path)) {
return;
}

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

@AChris07 AChris07 added the bug Something isn't working label May 8, 2023
@nitin2io
Copy link

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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants