[FIX] website: debounce link dialog inputs to avoid useless page loading

When we edit a link on the website, the target page is loaded to find
the anchors. This occured at every typed character which was obviously
not efficient.

task-2187754

closes odoo/odoo#45831

X-original-commit: 06ae0b7b00c837733a9c67772007aee6712b246e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Ravi Singh
2020-02-20 14:51:13 +00:00
committed by qsm-odoo
parent 078b9acce7
commit f47b142a7a
@@ -15,7 +15,15 @@ weWidgets.LinkDialog.include({
custom_events: _.extend({}, weWidgets.LinkDialog.prototype.custom_events || {}, {
website_url_chosen: '_onAutocompleteClose',
}),
LINK_DEBOUNCE: 1000,
/**
* @constructor
*/
init: function () {
this._super.apply(this, arguments);
this._adaptPageAnchor = _.debounce(this._adaptPageAnchor, this.LINK_DEBOUNCE);
},
/**
* Allows the URL input to propose existing website pages.
*