Fixup, use string for INCINERATOR_ADDRESS

This commit is contained in:
Ladd Hoffman 2023-07-09 14:25:34 -05:00
parent dd582c4d20
commit f978c20104
4 changed files with 13 additions and 22 deletions

View File

@ -313,9 +313,6 @@ export class Forum extends ReputationHolder {
this.actions.propagate.log(post, author, `(${authorIncrement})`); this.actions.propagate.log(post, author, `(${authorIncrement})`);
} }
// Increment the value of the post
await post.setValue(newValue);
console.log('propagateValue end', { console.log('propagateValue end', {
depth, depth,
increment, increment,
@ -325,6 +322,9 @@ export class Forum extends ReputationHolder {
refundToInbound, refundToInbound,
}); });
// Increment the value of the post
await post.setValue(newValue);
return refundToInbound; return refundToInbound;
} }
} }

View File

@ -2,7 +2,7 @@ export class Vertex {
constructor(graph, type, id, data, options = {}) { constructor(graph, type, id, data, options = {}) {
this.graph = graph; this.graph = graph;
this.type = type; this.type = type;
this._id = id; this.id = id;
this.data = data; this.data = data;
this.options = options; this.options = options;
this.edges = { this.edges = {
@ -16,14 +16,6 @@ export class Vertex {
this.installedClickCallback = false; this.installedClickCallback = false;
} }
set id(newId) {
this._id = newId;
}
get id() {
return this._id;
}
getEdges(type, away) { getEdges(type, away) {
return this.edges[away ? 'from' : 'to'].filter( return this.edges[away ? 'from' : 'to'].filter(
(edge) => edge.type === type, (edge) => edge.type === type,
@ -66,18 +58,17 @@ export class Vertex {
name: 'Save', name: 'Save',
cb: ({ form: { value } }, { initializing }) => { cb: ({ form: { value } }, { initializing }) => {
if (initializing) return; if (initializing) return;
let fullRedraw = false;
if (value.id && value.id !== vertex.id) { if (value.id && value.id !== vertex.id) {
// TODO: When an ID changes we really need to wipe out and redraw! fullRedraw = true;
// But we don't yet have a systematic approach for doing that.
// Everything is getting rendered as needed. Lacking abstraction.
// HMM we're not actually that far! Just wipe everything out and draw each vertex and edge :)
// for (const vertex of )
// for (const edge of [...vertex.edges.to, ...vertex.edges.from]) {
// edge.displayEdge();
// }
} }
Object.assign(vertex, value); Object.assign(vertex, value);
vertex.displayVertex(); vertex.displayVertex();
if (fullRedraw) {
graph.redraw();
}
},
})
}, },
}); });

View File

@ -83,7 +83,7 @@ export class WeightedDirectedGraph {
} }
} }
// Rerender // Ensure rerender
this.flowchart?.render(); this.flowchart?.render();
} }

View File

@ -1,6 +1,6 @@
export const EPSILON = 2.23e-16; export const EPSILON = 2.23e-16;
export const INCINERATOR_ADDRESS = 0; export const INCINERATOR_ADDRESS = '0';
export const EdgeTypes = { export const EdgeTypes = {
CITATION: 'citation', CITATION: 'citation',