[FIX] web_editor: process historyStepsBuffer
Before this commit, any history step received before the history is fully synchronised (`historySyncFinished`), would not be processed. As a fail safe, this commit adds a buffer that will be processed as soon as the history synchronization is finished (`historySyncFinished`). task-3217719 X-original-commit: acb58f921721b162954146f3c5364cb26823265f Part-of: odoo/odoo#114583
This commit is contained in:
@@ -468,6 +468,7 @@ const Wysiwyg = Widget.extend({
|
||||
// Wether or not the history has been sent or received at least once.
|
||||
let historySyncAtLeastOnce = false;
|
||||
let historySyncFinished = false;
|
||||
let historyStepsBuffer = [];
|
||||
|
||||
return new PeerToPeer({
|
||||
peerConnectionConfig: { iceServers: this._iceServers },
|
||||
@@ -556,6 +557,11 @@ const Wysiwyg = Widget.extend({
|
||||
this.odooEditor.onExternalMultiselectionUpdate(remoteSelection);
|
||||
}
|
||||
}
|
||||
// In case there are steps received in the meantime, process them.
|
||||
if (historyStepsBuffer.length) {
|
||||
this.odooEditor.onExternalHistorySteps(historyStepsBuffer);
|
||||
historyStepsBuffer = [];
|
||||
}
|
||||
historySyncFinished = true;
|
||||
} else {
|
||||
const remoteSelection = await this.ptp.requestClient(fromClientId, 'get_collaborative_selection', undefined, { transport: 'rtc' });
|
||||
@@ -570,6 +576,8 @@ const Wysiwyg = Widget.extend({
|
||||
// before the history has synced at least once.
|
||||
if (historySyncFinished) {
|
||||
this.odooEditor.onExternalHistorySteps([notificationPayload]);
|
||||
} else {
|
||||
historyStepsBuffer.push(notificationPayload);
|
||||
}
|
||||
break;
|
||||
case 'oe_history_set_selection': {
|
||||
|
||||
Reference in New Issue
Block a user