[FIX] web_editor: set the clientId after creating it
Before this commit, when creating a new record, there is no `_currentClientId` set in the wysiwyg as there is no collaboration setup for new records. When the user save the record, there is a call to `Wysiwyg.resetEditor` but as the `OdooEditor.collaborationSetClientId` was called before `Wysiwyg.setupCollaboration`, the `_currentClientId` was not set. That lead to the `OdooEditor._collabClientId` being undefined, which lead `OdooEditor.serializeNode` to not serialize the node through the function `serializeNode`. So unless the client A reload it's page, if another client (B) open the same record and synchronize with client A, client A will send it's history when `get_history_from_snapshot` is triggered but no `_historySteps` mutations nodes will not be serialized. So when client B will receive the steps in `historyResetFromSteps`, the code will crash. After this commit, the proper order will set the _currentClientId in time because `collaborationSetClientId` is set after `setupCollaboration`. task-3359732 closes odoo/odoo#125599 X-original-commit: 85acd380cab34ca507251c8b232520c76f2a3e58 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -2658,10 +2658,10 @@ const Wysiwyg = Widget.extend({
|
||||
this.odooEditor.historyReset();
|
||||
return;
|
||||
}
|
||||
this.odooEditor.collaborationSetClientId(this._currentClientId);
|
||||
this.setValue(value);
|
||||
this.odooEditor.historyReset();
|
||||
this.setupCollaboration(collaborationChannel);
|
||||
this.odooEditor.collaborationSetClientId(this._currentClientId);
|
||||
this.odooEditor.historyReset();
|
||||
if (this.options.collaborativeTrigger === 'start') {
|
||||
this._joinPeerToPeer();
|
||||
} else if (this.options.collaborativeTrigger === 'focus') {
|
||||
|
||||
Reference in New Issue
Block a user