mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 19:58:09 +00:00
UBER-472: don't update when it's not needed (#3460)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
70d78e50b3
commit
dbfbcc12ee
@ -59,9 +59,11 @@
|
||||
return
|
||||
}
|
||||
if (prevValue !== undefined) {
|
||||
prevValue.txes.forEach((p) => (p.isNew = false))
|
||||
const txes = prevValue.txes
|
||||
await client.update(prevValue, { txes })
|
||||
if (prevValue.txes.some((p) => p.isNew)) {
|
||||
prevValue.txes.forEach((p) => (p.isNew = false))
|
||||
const txes = prevValue.txes
|
||||
await client.update(prevValue, { txes })
|
||||
}
|
||||
}
|
||||
const targetClass = hierarchy.getClass(value.attachedToClass)
|
||||
const panelComponent = hierarchy.as(targetClass, view.mixin.ObjectPanel)
|
||||
|
@ -62,8 +62,10 @@ export class NotificationClientImpl implements NotificationClient {
|
||||
const client = getClient()
|
||||
const docUpdate = this.docUpdatesMap.get(_id)
|
||||
if (docUpdate !== undefined) {
|
||||
docUpdate.txes.forEach((p) => (p.isNew = false))
|
||||
await client.update(docUpdate, { txes: docUpdate.txes })
|
||||
if (docUpdate.txes.some((p) => p.isNew)) {
|
||||
docUpdate.txes.forEach((p) => (p.isNew = false))
|
||||
await client.update(docUpdate, { txes: docUpdate.txes })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +73,10 @@ export class NotificationClientImpl implements NotificationClient {
|
||||
const client = getClient()
|
||||
const docUpdate = this.docUpdatesMap.get(_id)
|
||||
if (docUpdate !== undefined) {
|
||||
docUpdate.txes.forEach((p) => (p.isNew = false))
|
||||
await client.update(docUpdate, { txes: docUpdate.txes })
|
||||
if (docUpdate.txes.some((p) => p.isNew)) {
|
||||
docUpdate.txes.forEach((p) => (p.isNew = false))
|
||||
await client.update(docUpdate, { txes: docUpdate.txes })
|
||||
}
|
||||
} else {
|
||||
const doc = await client.findOne(_class, { _id })
|
||||
if (doc !== undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user