diff --git a/src/api/converter.ts b/src/api/converter.ts index 905a3ca3f..15fe96091 100644 --- a/src/api/converter.ts +++ b/src/api/converter.ts @@ -596,16 +596,16 @@ function toTreeNodesWhenEdit(nodes: Array): Array { * `toRHT` converts the given model to Protobuf format. */ function toRHT(rht: RHT): { [key: string]: PbNodeAttr } { - const pbAttrs: { [key: string]: PbNodeAttr } = {}; - for (const [key, rhtNode] of rht.getNodeMapByKey()) { - pbAttrs[key] = new PbNodeAttr({ - value: rhtNode.getValue(), - updatedAt: toTimeTicket(rhtNode.getUpdatedAt()), - isRemoved: rhtNode.isRemoved(), + const pbRHT: { [key: string]: PbNodeAttr } = {}; + for (const node of rht) { + pbRHT[node.getKey()] = new PbNodeAttr({ + value: node.getValue(), + updatedAt: toTimeTicket(node.getUpdatedAt()), + isRemoved: node.isRemoved(), }); } - return pbAttrs; + return pbRHT; } /**