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

ICO-245 Fix homepage loading #118

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

claudiulazardd
Copy link
Collaborator

@claudiulazardd claudiulazardd commented Feb 25, 2025

  1. It seems for homepage you need to send "/", not empty ""
  2. Replace the url with the new seo-url based on the language. This will only happen for cms page/pdp/landing pages.
    If the admin of the shopware configures categories with different seo-urls per language, we need to do a request do get the new seoPathInfo for the active navigation so that we can replace the url to the one which is language specific. In this way if the user refreshes the page it will get the page instead of having a 404 because it tried getting a SEO-URL for a different language.

locale.value !== defaultLocale
? route.path.replace(/^\/[^/]+/, '')
? route.path.replace(/^\/[^\/]+/, '')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you run bun run lint locally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed ✅

: route.path;

if (routePath === '') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain in which circumstances this is needed? Like provide an example where this gives an error without the change for example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is triggered because we are using the routePath which is either example.com or example.com/en-GB.
For the home route we are either having then the routePath as an empty string for the default locale or if the defaultLocale is not the same with the active locale then we remove the /${whateverLocaleisSetupHere} and that leads us to having a route as ''. Which normally should serve as homepage, but shopware needs an ending slash so if we do not have this, it crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants