interface: threading works for complex graph structures

This commit is contained in:
Logan Allen 2021-05-18 18:04:27 -05:00
parent d6d085c1ae
commit d308b96909
4 changed files with 9 additions and 15 deletions

View File

@ -364,7 +364,7 @@ export default class GraphApi extends BaseApi<StoreState> {
async getFirstborn(ship: string, resource: string, index = '') {
const idx = index.split('/').map(decToUd).join('/');
const data = await this.scry<any>('graph-store',
`/firstborn/${ship}/${resource}/${idx}`
`/firstborn/${ship}/${resource}${idx}`
);
const node = data['graph-update'];
this.store.handleEvent({

View File

@ -67,7 +67,6 @@ const addNodesFlat = (json: any, state: GraphState): GraphState => {
}
const indices = Array.from(Object.keys(data.nodes));
console.log(indices);
indices.forEach((index) => {
if (index.split('/').length === 0) { return; }
@ -87,7 +86,6 @@ const addNodesFlat = (json: any, state: GraphState): GraphState => {
const addNodesThread = (json: any, state: GraphState): GraphState => {
const data = _.get(json, 'add-nodes', false);
const parentIndex = _.get(json, 'index', false);
console.log(json);
if (data && parentIndex) {
if (!('threadGraphs' in state)) {
return state;
@ -103,8 +101,6 @@ const addNodesThread = (json: any, state: GraphState): GraphState => {
state.threadGraphs[resource][parentIndex] = new BigIntArrayOrderedMap([], true);
}
console.log(state.threadGraphs);
indices.forEach((index) => {
if (index.split('/').length === 0) { return; }
const indexArr = index.split('/').slice(1).map((ind) => bigInt(ind));
@ -319,7 +315,6 @@ const addNodes = (json, state) => {
if (node.post.pending) {
state.graphTimesentMap[resource][node.post['time-sent']] = index;
console.log('set pending', index);
}
state.graphs[resource] = _addNode(

View File

@ -7,7 +7,8 @@ import GlobalApi from '~/logic/api/global';
import { resourceFromPath } from '~/logic/lib/group';
import ArrayVirtualScroller, {
indexEqual,
arrToString
arrToString,
stringToArr
} from '~/views/components/ArrayVirtualScroller';
import PostItem from './PostItem/PostItem';
import PostInput from './PostInput';
@ -62,9 +63,7 @@ class PostFlatFeed extends React.Component<PostFeedProps, PostFeedState> {
return null;
}
if (arrToString(index) !== node.post.index) {
console.log(node.post.index, arrToString(index), node);
}
let key = arrToString(index);
const first = flatGraph.peekLargest()?.[0];
const last = flatGraph.peekSmallest()?.[0];
@ -78,7 +77,7 @@ class PostFlatFeed extends React.Component<PostFeedProps, PostFeedState> {
pt={3}
width="100%"
alignItems="center"
key={arrToString(index)}
key={key}
ref={ref}>
<PostItem
node={node}
@ -103,7 +102,7 @@ class PostFlatFeed extends React.Component<PostFeedProps, PostFeedState> {
<Col
width="100%"
alignItems="center"
key={arrToString(index)}
key={key}
ref={ref}>
<Col
width="100%"
@ -139,7 +138,7 @@ class PostFlatFeed extends React.Component<PostFeedProps, PostFeedState> {
}
return (
<Box key={arrToString(index)} ref={ref}>
<Box key={key} ref={ref}>
<PostItem
node={node}
graphPath={graphPath}

View File

@ -32,8 +32,8 @@ export function sortBigIntArr(a: BigInteger[], b: BigInteger[]) {
let aLen = a.length;
let bLen = b.length;
let aCop = a.slice();
let bCop = b.slice();
let aCop = a.slice(0);
let bCop = b.slice(0);
aCop.reverse();
bCop.reverse();