Closed lerickson-control4 closed 3 years ago
for completeness ,buildNode.ts
looks like this:
export default function buildNode(item: Item, index: number) {
const node = new BoundNodeModel({
item,
name: item.name,
color: item.type === "agent" ? "darkorchid" : "darkorange",
type: "boundNode"
});
node.setPosition(randomInteger(1024), randomInteger(768));
return node;
}
I don't think you need the <NodeWidget>
in BoundNode.tsx. You could just use a div.
See the custom node example here:
@rob-myers sure enough, removing NodeWidget did the trick. Thanks!
Hi. I really like what I see in react-diagrams, but I've run into an issue that I can't noodle my way out of. I have run some of the more basic samples successfully, and then started experimenting with node and port factories and everything blew up (read: I'm stuck in an infinite render loop). I can't tell what state change is triggering the renders. I'm following (sort of) the
demo-custom-node1
sample.Some of the pertinent details:
App.ts
initEngine.ts
BoundNodeFactory.tsx (excerpt)
BoundNodeModel.ts
BoundNode.tsx
What I see in the console output is one logging of "initEngine", one logging of "generating model", but endless logging of "generating widget", meaning the factory's generateReactWidget method is getting spammed, meaning GenerateWidgetEvents are getting spammed, and I don't know why. The BoundNode props are also logged endlessly.
Any chance I could get another pair of eyes on this? It seems like I'm following "the pattern" precisely.
My repo is found here: https://github.com/lerickson-control4/react-diagrams-test