Skip to content

Commit acb58f9

Browse files
committed
[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 Part-of: odoo#114481
1 parent 974e6a5 commit acb58f9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

addons/web_editor/static/src/js/wysiwyg/wysiwyg.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ const Wysiwyg = Widget.extend({
468468
// Wether or not the history has been sent or received at least once.
469469
let historySyncAtLeastOnce = false;
470470
let historySyncFinished = false;
471+
let historyStepsBuffer = [];
471472

472473
return new PeerToPeer({
473474
peerConnectionConfig: { iceServers: this._iceServers },
@@ -556,6 +557,11 @@ const Wysiwyg = Widget.extend({
556557
this.odooEditor.onExternalMultiselectionUpdate(remoteSelection);
557558
}
558559
}
560+
// In case there are steps received in the meantime, process them.
561+
if (historyStepsBuffer.length) {
562+
this.odooEditor.onExternalHistorySteps(historyStepsBuffer);
563+
historyStepsBuffer = [];
564+
}
559565
historySyncFinished = true;
560566
} else {
561567
const remoteSelection = await this.ptp.requestClient(fromClientId, 'get_collaborative_selection', undefined, { transport: 'rtc' });
@@ -570,6 +576,8 @@ const Wysiwyg = Widget.extend({
570576
// before the history has synced at least once.
571577
if (historySyncFinished) {
572578
this.odooEditor.onExternalHistorySteps([notificationPayload]);
579+
} else {
580+
historyStepsBuffer.push(notificationPayload);
573581
}
574582
break;
575583
case 'oe_history_set_selection': {

0 commit comments

Comments
 (0)