permanent user store writes updates in separate transaction
This commit is contained in:
parent
d90c9b1cb2
commit
7f0e25dcba
@ -55,7 +55,7 @@ export const followRedone = (store, id) => {
|
|||||||
item = getItem(store, nextID)
|
item = getItem(store, nextID)
|
||||||
diff = nextID.clock - item.id.clock
|
diff = nextID.clock - item.id.clock
|
||||||
nextID = item.redone
|
nextID = item.redone
|
||||||
} while (nextID !== null)
|
} while (nextID !== null && item instanceof Item)
|
||||||
return {
|
return {
|
||||||
item, diff
|
item, diff
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ export class PermanentUserData {
|
|||||||
}
|
}
|
||||||
user.get('ids').push([clientid])
|
user.get('ids').push([clientid])
|
||||||
users.observe(event => {
|
users.observe(event => {
|
||||||
|
setTimeout(() => {
|
||||||
const userOverwrite = users.get(userDescription)
|
const userOverwrite = users.get(userDescription)
|
||||||
if (userOverwrite !== user) {
|
if (userOverwrite !== user) {
|
||||||
// user was overwritten, port all data over to the next user object
|
// user was overwritten, port all data over to the next user object
|
||||||
@ -101,8 +102,10 @@ export class PermanentUserData {
|
|||||||
user.get('ds').push([encoding.toUint8Array(encoder)])
|
user.get('ds').push([encoding.toUint8Array(encoder)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, 0)
|
||||||
})
|
})
|
||||||
doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => {
|
doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => {
|
||||||
|
setTimeout(() => {
|
||||||
const yds = user.get('ds')
|
const yds = user.get('ds')
|
||||||
const ds = transaction.deleteSet
|
const ds = transaction.deleteSet
|
||||||
if (transaction.local && ds.clients.size > 0) {
|
if (transaction.local && ds.clients.size > 0) {
|
||||||
@ -111,6 +114,7 @@ export class PermanentUserData {
|
|||||||
yds.push([encoding.toUint8Array(encoder)])
|
yds.push([encoding.toUint8Array(encoder)])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {number} clientid
|
* @param {number} clientid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user