diff --git a/addons/website/static/src/client_actions/website_preview/website_preview.js b/addons/website/static/src/client_actions/website_preview/website_preview.js index c7d4b675760..b965a5c5211 100644 --- a/addons/website/static/src/client_actions/website_preview/website_preview.js +++ b/addons/website/static/src/client_actions/website_preview/website_preview.js @@ -365,10 +365,9 @@ export class WebsitePreview extends Component { const destinationUrl = new URL(href, window.location); destinationUrl.searchParams.delete('edit_translations'); destinationUrl.hash = this.websiteService.contentWindow.location.hash; - const forceLangUrl = `/website/lang/${lang}?r=${destinationUrl.toString()}`; this.websiteService.bus.trigger('LEAVE-EDIT-MODE', { onLeave: () => { - this.websiteService.goToWebsite({ path: forceLangUrl }); + this.websiteService.goToWebsite({ path: destinationUrl.toString(), lang }); }, reloadIframe: false, }); diff --git a/addons/website/static/src/services/website_service.js b/addons/website/static/src/services/website_service.js index 904c6e9faad..aadfbe23f5d 100644 --- a/addons/website/static/src/services/website_service.js +++ b/addons/website/static/src/services/website_service.js @@ -189,7 +189,11 @@ export const websiteService = { invalidateSnippetCache = value; }, - goToWebsite({ websiteId, path, edition, translation } = {}) { + goToWebsite({ websiteId, path, edition, translation, lang } = {}) { + if (lang) { + invalidateSnippetCache = true; + path = `/website/lang/${lang}?r=${encodeURIComponent(path)}`; + } action.doAction('website.website_preview', { clearBreadcrumbs: true, additionalContext: { diff --git a/addons/website/static/src/systray_items/edit_website.js b/addons/website/static/src/systray_items/edit_website.js index 8f44b72728d..79dc67469bd 100644 --- a/addons/website/static/src/systray_items/edit_website.js +++ b/addons/website/static/src/systray_items/edit_website.js @@ -47,7 +47,8 @@ class EditWebsiteSystray extends Component { const languagePrefix = `${pathname}/`.indexOf('/', 1); const defaultLanguagePathname = pathname.substring(languagePrefix); this.websiteService.goToWebsite({ - path: `/website/lang/default?r=${encodeURIComponent(defaultLanguagePathname + search + hash)}`, + path: defaultLanguagePathname + search + hash, + lang: 'default', edition: true }); } else {