From eaa6e4fdb350ded541e3ef3ef1856b4df2a49434 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Tue, 31 Oct 2023 09:28:36 +0100 Subject: [PATCH] [FIX] website: correctly debounce adaptAnchor Previously, we attempted to debounce in what appeared to be an override of the onWillStart method, but this method doesn't actually exist on the parent classes and as such is never registered with the onWillStart hook. This commit fixes that by registering it in an override of the setup method instead. task-3439226 Part-of: odoo/odoo#139209 --- addons/website/static/src/js/editor/widget_link.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/addons/website/static/src/js/editor/widget_link.js b/addons/website/static/src/js/editor/widget_link.js index 42ab50c5539..25f08b1eafe 100644 --- a/addons/website/static/src/js/editor/widget_link.js +++ b/addons/website/static/src/js/editor/widget_link.js @@ -3,21 +3,13 @@ import { LinkTools } from '@web_editor/js/wysiwyg/widgets/link_tools'; import { patch } from "@web/core/utils/patch"; -import { status, useEffect } from '@odoo/owl'; +import { onWillStart, status, useEffect } from '@odoo/owl'; import wUtils from "@website/js/utils"; import { debounce } from "@web/core/utils/timing"; const LINK_DEBOUNCE = 1000; patch(LinkTools.prototype, { - /** - * - * @override - */ - onWillStart() { - this._adaptPageAnchor = debounce(this._adaptPageAnchor, LINK_DEBOUNCE); - return super.onWillStart(...arguments); - }, /** * Allows the URL input to propose existing website pages. * @@ -31,6 +23,9 @@ patch(LinkTools.prototype, { setup() { super.setup(); + onWillStart(() => { + this._adaptPageAnchor = debounce(this._adaptPageAnchor, LINK_DEBOUNCE); + }); useEffect((container) => { const input = container?.querySelector(`input[name="url"]`); if (!input) {