-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: main
Are you sure you want to change the base?
Conversation
pages/[...all].vue
Outdated
locale.value !== defaultLocale | ||
? route.path.replace(/^\/[^/]+/, '') | ||
? route.path.replace(/^\/[^\/]+/, '') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 === '') { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.