mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
graph-update: fix recursive add-nodes case
This commit is contained in:
parent
27f2f93cc8
commit
4f6003fd24
@ -105,7 +105,7 @@ const removeGraph = (json, state: GraphState): GraphState => {
|
||||
};
|
||||
|
||||
const mapifyChildren = (children) => {
|
||||
return new BigIntOrderedMap(
|
||||
return new BigIntOrderedMap().gas(
|
||||
_.map(children, (node, idx) => {
|
||||
idx = idx && idx.startsWith('/') ? idx.slice(1) : idx;
|
||||
const nd = {...node, children: mapifyChildren(node.children || {}) };
|
||||
@ -214,12 +214,14 @@ const addNodes = (json, state) => {
|
||||
state.graphTimesentMap[resource][node.post['time-sent']] = index;
|
||||
}
|
||||
|
||||
node.children = mapifyChildren(node?.children || {});
|
||||
|
||||
|
||||
state.graphs[resource] = _addNode(
|
||||
state.graphs[resource],
|
||||
indexArr,
|
||||
node
|
||||
produce(node, draft => {
|
||||
draft.children = mapifyChildren(draft?.children || {});
|
||||
})
|
||||
);
|
||||
if(newSize !== old) {
|
||||
console.log(`${resource}, (${old}, ${newSize}, ${state.graphs[resource].size})`);
|
||||
|
@ -432,7 +432,6 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
|
||||
? this.savedDistance + ref.offsetTop
|
||||
: this.window.scrollHeight - ref.offsetTop - this.savedDistance;
|
||||
|
||||
console.log(ref.offsetTop);
|
||||
|
||||
this.window.scrollTo(0, newScrollTop);
|
||||
requestAnimationFrame(() => {
|
||||
@ -484,7 +483,6 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
|
||||
let bottomIndex = visibleItems[visibleItems.length - 1];
|
||||
const { scrollTop, scrollHeight } = this.window;
|
||||
const topSpacing = this.props.origin === 'top' ? scrollTop : scrollHeight - scrollTop;
|
||||
console.log(scrollTop);
|
||||
const items = this.props.origin === 'top' ? visibleItems : [...visibleItems].reverse();
|
||||
items.forEach((index) => {
|
||||
const el = this.childRefs.get(index.toString());
|
||||
@ -505,9 +503,7 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
|
||||
}
|
||||
|
||||
this.savedIndex = bottomIndex;
|
||||
console.log(this.childRefs.size);
|
||||
const ref = this.childRefs.get(bottomIndex.toString())!;
|
||||
console.log(ref);
|
||||
const { offsetTop } = ref;
|
||||
this.savedDistance = topSpacing - offsetTop
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user