You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: We encountered an issue in the removeSiteLocaleFromPath function within the url.js file of the retail-react-app module. Currently, the function uses the following regular expression to replace all matching characters related to the siteRef:
pathName.replace(newRegExp(`/${siteRef}`,'g'),'')
Issue: This regex replaces all occurrences of characters related to the siteRef across the entire path. However, some of our category names also include the same locale characters, which leads to unintended replacements. This affects the proper categorization and navigation.
Suggested Fix: We recommend modifying the regular expression to replace only the first occurrence of the siteRef, rather than all matches. You could implement this by removing the global ('g') flag, like so:
pathName.replace(newRegExp(`/${siteRef}`),'')
This would ensure only the first match is replaced, preserving the integrity of category names and other path segments.
Please let me know if you need more information or have any questions regarding this issue.
The text was updated successfully, but these errors were encountered:
Thanks for the issue @mohammedjamboo-pandora. We will look into this and will allocate resource to work as we see fit.
Which PWA Kit version are you on? If you are on v3, do you use extensibility?
Could you give us a few examples of what urls (cate with locale) you mentioned?
As you see in this example since the category name also starts with the same letters as the locale and so the function removeSiteLocaleFromPath actually replaces all instances of locale, in this case en with a blank leaving the category name as gravable
Description: We encountered an issue in the removeSiteLocaleFromPath function within the url.js file of the retail-react-app module. Currently, the function uses the following regular expression to replace all matching characters related to the siteRef:
Issue: This regex replaces all occurrences of characters related to the siteRef across the entire path. However, some of our category names also include the same locale characters, which leads to unintended replacements. This affects the proper categorization and navigation.
Suggested Fix: We recommend modifying the regular expression to replace only the first occurrence of the siteRef, rather than all matches. You could implement this by removing the global ('g') flag, like so:
This would ensure only the first match is replaced, preserving the integrity of category names and other path segments.
Please let me know if you need more information or have any questions regarding this issue.
The text was updated successfully, but these errors were encountered: