mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 04:49:00 +00: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>
|
</div>
|
||||||
{/if}
|
{/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}
|
{#if showTextStyleToolbar}
|
||||||
<TextEditorStyleToolbar
|
<TextEditorStyleToolbar
|
||||||
textEditor={editor}
|
textEditor={editor}
|
||||||
@ -326,7 +330,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</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} />
|
<ImageStyleToolbar textEditor={editor} formatButtonSize={buttonSize} on:focus={handleFocus} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -54,13 +54,14 @@ export class StorageExtension implements Extension {
|
|||||||
|
|
||||||
async onStoreDocument ({ context, documentName, document }: withContext<onStoreDocumentPayload>): Promise<void> {
|
async onStoreDocument ({ context, documentName, document }: withContext<onStoreDocumentPayload>): Promise<void> {
|
||||||
const collaborators = this.collaborators.get(documentName)
|
const collaborators = this.collaborators.get(documentName)
|
||||||
|
|
||||||
if (collaborators === undefined || collaborators.size === 0) {
|
if (collaborators === undefined || collaborators.size === 0) {
|
||||||
console.log('no changes for document', documentName)
|
console.log('no changes for document', documentName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.collaborators.delete(documentName)
|
||||||
await this.configuration.ctx.with('store-document', {}, async () => {
|
await this.configuration.ctx.with('store-document', {}, async () => {
|
||||||
this.collaborators.delete(documentName)
|
|
||||||
await this.storeDocument(documentName, document, context)
|
await this.storeDocument(documentName, document, context)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -68,12 +69,14 @@ export class StorageExtension implements Extension {
|
|||||||
async onDisconnect ({ context, documentName, document }: withContext<onDisconnectPayload>): Promise<any> {
|
async onDisconnect ({ context, documentName, document }: withContext<onDisconnectPayload>): Promise<any> {
|
||||||
const { connectionId } = context
|
const { connectionId } = context
|
||||||
const collaborators = this.collaborators.get(documentName)
|
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)
|
console.log('no changes for document', documentName)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.collaborators.delete(documentName)
|
||||||
await this.configuration.ctx.with('store-document', {}, async () => {
|
await this.configuration.ctx.with('store-document', {}, async () => {
|
||||||
this.collaborators.get(documentName)?.delete(connectionId)
|
|
||||||
await this.storeDocument(documentName, document, context)
|
await this.storeDocument(documentName, document, context)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user