mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 19:44:59 +03:00
UBERF-4777 Fix redundant updates from collaborator (#4280)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
f4d6faf4f8
commit
5ddcaf4051
@ -314,7 +314,11 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="text-editor-toolbar buttons-group xsmall-gap mb-4" bind:this={textToolbarElement}>
|
||||
<div
|
||||
class="text-editor-toolbar buttons-group xsmall-gap mb-4"
|
||||
bind:this={textToolbarElement}
|
||||
style="visibility: hidden;"
|
||||
>
|
||||
{#if showTextStyleToolbar}
|
||||
<TextEditorStyleToolbar
|
||||
textEditor={editor}
|
||||
@ -326,7 +330,11 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="text-editor-toolbar buttons-group xsmall-gap mb-4" bind:this={imageToolbarElement}>
|
||||
<div
|
||||
class="text-editor-toolbar buttons-group xsmall-gap mb-4"
|
||||
bind:this={imageToolbarElement}
|
||||
style="visibility: hidden;"
|
||||
>
|
||||
<ImageStyleToolbar textEditor={editor} formatButtonSize={buttonSize} on:focus={handleFocus} />
|
||||
</div>
|
||||
|
||||
|
@ -54,13 +54,14 @@ export class StorageExtension implements Extension {
|
||||
|
||||
async onStoreDocument ({ context, documentName, document }: withContext<onStoreDocumentPayload>): Promise<void> {
|
||||
const collaborators = this.collaborators.get(documentName)
|
||||
|
||||
if (collaborators === undefined || collaborators.size === 0) {
|
||||
console.log('no changes for document', documentName)
|
||||
return
|
||||
}
|
||||
|
||||
this.collaborators.delete(documentName)
|
||||
await this.configuration.ctx.with('store-document', {}, async () => {
|
||||
this.collaborators.delete(documentName)
|
||||
await this.storeDocument(documentName, document, context)
|
||||
})
|
||||
}
|
||||
@ -68,12 +69,14 @@ export class StorageExtension implements Extension {
|
||||
async onDisconnect ({ context, documentName, document }: withContext<onDisconnectPayload>): Promise<any> {
|
||||
const { connectionId } = context
|
||||
const collaborators = this.collaborators.get(documentName)
|
||||
if (collaborators === undefined || !this.collaborators.has(connectionId)) {
|
||||
|
||||
if (collaborators === undefined || !collaborators.has(connectionId)) {
|
||||
console.log('no changes for document', documentName)
|
||||
return
|
||||
}
|
||||
|
||||
this.collaborators.delete(documentName)
|
||||
await this.configuration.ctx.with('store-document', {}, async () => {
|
||||
this.collaborators.get(documentName)?.delete(connectionId)
|
||||
await this.storeDocument(documentName, document, context)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user