Skip to content

Commit

Permalink
Revise codes
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Jun 4, 2024
1 parent 85473c8 commit 21ed39c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/api/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,16 +596,16 @@ function toTreeNodesWhenEdit(nodes: Array<CRDTTreeNode>): Array<PbTreeNodes> {
* `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;
}

/**
Expand Down

0 comments on commit 21ed39c

Please sign in to comment.