Correct set() behaviour (return new ref)
This commit is contained in:
parent
bd4b0f9736
commit
642d7592ac
1 changed files with 6 additions and 4 deletions
|
|
@ -78,6 +78,7 @@ const handleMsg = msg => {
|
|||
|
||||
if (pendingPut) {
|
||||
pendingPutsForPath.splice(idx, 1)
|
||||
|
||||
if (pendingPut.cb) {
|
||||
pendingPut.cb(ack)
|
||||
}
|
||||
|
|
@ -170,7 +171,7 @@ const forge = () => {
|
|||
currentGun = newGun
|
||||
|
||||
// currentGun.on('', e => {
|
||||
// console.log('event from subp')
|
||||
// console.log('event from subprocess')
|
||||
// console.log(e)
|
||||
// })
|
||||
|
||||
|
|
@ -351,16 +352,17 @@ function createReplica(path, afterMap = false) {
|
|||
throw new Error('Cannot call set() after map() on a GunSmith node')
|
||||
}
|
||||
// @ts-expect-error
|
||||
const uuid = Gun.text.random()
|
||||
return this.put(
|
||||
const id = Gun.text.random()
|
||||
this.put(
|
||||
{
|
||||
[uuid]: data
|
||||
[id]: data
|
||||
},
|
||||
ack => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
cb && cb(ack)
|
||||
}
|
||||
)
|
||||
return this.get(id)
|
||||
},
|
||||
user(pub) {
|
||||
if (path !== '$root') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue