[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
This commit is contained in:
Géry Debongnie
2023-02-06 12:09:51 +01:00
parent da874e053e
commit fd5b2e6a20
@@ -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 = [
{