From 58c3c734978b88c2705d9ec09bdce7afca5c6e26 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Sun, 12 Sep 2021 17:22:34 -0400 Subject: [PATCH] Add set() functionality --- utils/GunSmith/GunSmith.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/GunSmith/GunSmith.js b/utils/GunSmith/GunSmith.js index 47976e39..9689e868 100644 --- a/utils/GunSmith/GunSmith.js +++ b/utils/GunSmith/GunSmith.js @@ -349,7 +349,17 @@ function createReplica(path, afterMap = false) { if (afterMap) { throw new Error('Cannot call set() after map() on a GunSmith node') } - return this + // @ts-expect-error + const uuid = Gun.text.random() + return this.put( + { + [uuid]: data + }, + ack => { + // eslint-disable-next-line no-unused-expressions + cb && cb(ack) + } + ) }, user(pub) { if (path !== '$root') {