Stamp time on duplicateBlockTree

This commit is contained in:
Chen-I Lim 2021-03-03 10:46:50 -08:00
parent ad4d43698c
commit 08107e6537

View file

@ -98,9 +98,12 @@ class OctoUtils {
// Creates a copy of the blocks with new ids and parentIDs
static duplicateBlockTree(blocks: readonly IBlock[], sourceBlockId: string): [MutableBlock[], MutableBlock, Readonly<Record<string, string>>] {
const idMap: Record<string, string> = {}
const now = Date.now()
const newBlocks = blocks.map((block) => {
const newBlock = this.hydrateBlock(block)
newBlock.id = Utils.createGuid()
newBlock.createAt = now
newBlock.updateAt = now
idMap[block.id] = newBlock.id
return newBlock
})