mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
graph-update: fix add-graph
This commit is contained in:
parent
9304409e8b
commit
19f9dd6009
@ -52,23 +52,18 @@ const keys = (json, state: GraphState): GraphState => {
|
|||||||
const processNode = (node) => {
|
const processNode = (node) => {
|
||||||
// is empty
|
// is empty
|
||||||
if (!node.children) {
|
if (!node.children) {
|
||||||
node.children = new BigIntOrderedMap();
|
return produce(node, draft => {
|
||||||
return node;
|
draft.children = new BigIntOrderedMap();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// is graph
|
// is graph
|
||||||
let converted = new BigIntOrderedMap();
|
return produce(node, draft => {
|
||||||
for (let idx in node.children) {
|
draft.children = new BigIntOrderedMap()
|
||||||
let item = node.children[idx];
|
.gas(_.map(draft.children, (item, idx) =>
|
||||||
let index = bigInt(idx);
|
[bigInt(idx), processNode(item)] as [BigInteger, any]
|
||||||
|
));
|
||||||
converted.set(
|
});
|
||||||
index,
|
|
||||||
processNode(item)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
node.children = converted;
|
|
||||||
return node;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -89,6 +84,7 @@ const addGraph = (json, state: GraphState): GraphState => {
|
|||||||
state.graphs[resource] = state.graphs[resource].gas(Object.keys(data.graph).map(idx => {
|
state.graphs[resource] = state.graphs[resource].gas(Object.keys(data.graph).map(idx => {
|
||||||
return [bigInt(idx), processNode(data.graph[idx])];
|
return [bigInt(idx), processNode(data.graph[idx])];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
state.graphKeys.add(resource);
|
state.graphKeys.add(resource);
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
Loading…
Reference in New Issue
Block a user