diff --git a/pkg/interface/src/logic/api/graph.ts b/pkg/interface/src/logic/api/graph.ts index aba70dacf2..ef999a8a6a 100644 --- a/pkg/interface/src/logic/api/graph.ts +++ b/pkg/interface/src/logic/api/graph.ts @@ -83,7 +83,7 @@ export default class GraphApi extends BaseApi { joiningGraphs = new Set(); private storeAction(action: any): Promise { - return this.action('graph-store', 'graph-update-1', action); + return this.action('graph-store', 'graph-update-2', action); } private viewAction(threadName: string, action: any) { @@ -91,7 +91,7 @@ export default class GraphApi extends BaseApi { } private hookAction(ship: Patp, action: any): Promise { - return this.action('graph-push-hook', 'graph-update-1', action); + return this.action('graph-push-hook', 'graph-update-2', action); } createManagedGraph( @@ -227,7 +227,7 @@ export default class GraphApi extends BaseApi { }; const pendingPromise = this.spider( - 'graph-update-1', + 'graph-update-2', 'graph-view-action', 'graph-add-nodes', action @@ -283,9 +283,9 @@ export default class GraphApi extends BaseApi { } - removeNodes(ship: Patp, name: string, indices: string[]) { + removePosts(ship: Patp, name: string, indices: string[]) { return this.hookAction(ship, { - 'remove-nodes': { + 'remove-posts': { resource: { ship, name }, indices } diff --git a/pkg/interface/src/logic/reducers/graph-update.ts b/pkg/interface/src/logic/reducers/graph-update.ts index 06e14eade1..d60aec4258 100644 --- a/pkg/interface/src/logic/reducers/graph-update.ts +++ b/pkg/interface/src/logic/reducers/graph-update.ts @@ -13,7 +13,7 @@ export const GraphReducer = (json) => { addGraph, removeGraph, addNodes, - removeNodes + removePosts ]); } const loose = _.get(json, 'graph-update-loose', false); @@ -181,7 +181,6 @@ const addNodes = (json, state) => { graph = _killByFuzzyTimestamp(graph, resource, post['time-sent']); graph = _killByFuzzyTimestamp(graph, resource, post['time-sent'] - 1); graph = _killByFuzzyTimestamp(graph, resource, post['time-sent'] + 1); - return graph; }; @@ -240,10 +239,10 @@ const addNodes = (json, state) => { return state; }; -const removeNodes = (json, state: GraphState): GraphState => { +const removePosts = (json, state: GraphState): GraphState => { const _remove = (graph, index) => { if (index.length === 1) { - graph.delete(index[0]); + graph.set(index[0], child.post.hash); } else { const child = graph.get(index[0]); if (child) { @@ -253,7 +252,7 @@ const removeNodes = (json, state: GraphState): GraphState => { } }; - const data = _.get(json, 'remove-nodes', false); + const data = _.get(json, 'remove-posts', false); if (data) { const { ship, name } = data.resource; const res = `${ship}/${name}`;