[FIX] website: fix traceback on refresh
Commit [1] made it possible to stay in the backend while refreshing the page with F5 or CTRL+R when viewing a Website Preview. Pressing it too fast when the page is still loading and the iframe isn't loaded yet triggers a traceback. This commit falls back to the default refresh in such cases. [1]: https://github.com/odoo/odoo/commit/e69c6eaed4e82e08d6bbf807cf4698f6327a9cdd task-3795143 closes odoo/odoo#158314 X-original-commit: c81dfa7dda95a8d63b4abba9ce67d7f3e48af935 Signed-off-by: Arthur Detroux (ard) <ard@odoo.com> Signed-off-by: Robin Lejeune (role) <role@odoo.com>
This commit is contained in:
@@ -553,6 +553,10 @@ export class WebsitePreview extends Component {
|
||||
if (hotkey !== 'control+r' && hotkey !== 'f5') {
|
||||
return;
|
||||
}
|
||||
// The iframe isn't loaded yet: fallback to default refresh.
|
||||
if (this.websiteService.contentWindow === undefined) {
|
||||
return;
|
||||
}
|
||||
ev.preventDefault();
|
||||
const path = this.websiteService.contentWindow.location;
|
||||
const debugMode = this.env.debug ? `?debug=${this.env.debug}` : "";
|
||||
|
||||
Reference in New Issue
Block a user