[FIX] website, website_sale: fix race condition on dynamic snippet

Prior to this commit:

    A race condition could occur when dropping the dynamic product snippet
    creating a traceback "Cannot read property 'limit' of undefined".

After this commit:

    Potential race condition has been removed from the code.

closes odoo/odoo#61890

X-original-commit: de14be4986ef4a293b99523b7dc110be3b16b8ea
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Laurent Stukkens (LTU)
2020-11-17 17:59:15 +00:00
parent 5cf0f5e209
commit baaaadd470
2 changed files with 6 additions and 4 deletions
@@ -62,8 +62,9 @@ const dynamicSnippetOptions = snippetOptions.SnippetOptionWidget.extend({
* @override
* @private
*/
_renderCustomXML: function (uiFragment) {
return Promise.all([this._renderDynamicFiltersSelector(uiFragment), this._renderDynamicFilterTemplatesSelector(uiFragment)]);
_renderCustomXML: async function (uiFragment) {
await this._renderDynamicFiltersSelector(uiFragment);
await this._renderDynamicFilterTemplatesSelector(uiFragment);
},
/**
* Renders the dynamic filter option selector content into the provided uiFragment.
@@ -68,8 +68,9 @@ const dynamicSnippetProductsOptions = s_dynamic_snippet_carousel_options.extend(
* @override
* @private
*/
_renderCustomXML: function (uiFragment) {
return Promise.all([this._super.apply(this, arguments), this._renderProductCategorySelector(uiFragment)]);
_renderCustomXML: async function (uiFragment) {
await this._super.apply(this, arguments);
await this._renderProductCategorySelector(uiFragment);
},
/**
* Renders the product categories option selector content into the provided uiFragment.