From fd5b2e6a20e5a0c823633ab010623d7c4dd44e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 1 Feb 2023 09:46:33 +0000 Subject: [PATCH] [IMP] web_editor: only load ice server configuration once Before this commit, the web editor loaded the configuration for ice servers each time it was created. It is useless to do it more than once, so this commit simply keep the initial value around. Part-of: odoo/odoo#111571 --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index be627b30ba3..e44306e5000 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -63,6 +63,9 @@ const PTP_CLIENT_DISCONNECTED_STATES = [ 'disconnected', ]; +// this is a local cache for ice server descriptions +let ICE_SERVERS = null; + const Wysiwyg = Widget.extend({ defaultOptions: { lang: 'odoo', @@ -611,7 +614,10 @@ const Wysiwyg = Widget.extend({ this._peerToPeerLoading = new Promise(async (resolve) => { this._currentRecord = await this._getCurrentRecord(); - let iceServers = await this._rpc({route: '/web_editor/get_ice_servers'}); + if (!ICE_SERVERS) { + ICE_SERVERS = await this._rpc({route: '/web_editor/get_ice_servers'}); + } + let iceServers = structuredClone(ICE_SERVERS); if (!iceServers.length) { iceServers = [ {