Closed smashboy closed 3 years ago
Maybe you need to call this.editorEngine.repaintCanvas()
inside the setTimeout
callback?
@renato-bohler I was trying that too, I can't undedstand how it works at all.
I wrote handler in my custom Widget that should repaint canvas each time I'm trying to update dimensions, but it still doesn't work properly. TableNodeView
is a RFC and I'm calling updateDimensions
in useEffect on first mount to adjust size to content that is inside node. It is updating dimensions only when I click on table.
Also I was trying to pass this.props.node.isSelected
and this.props.node.updateDimensions
directly to my RFC component and when they are called I'm getting errors, because of this issue also have to wrap or call functions directly in TableNodeWidget
. UpdateDimensions
throws Cannot read property 'width' of undefined, when width is hardcoded to function call.
Also I don't think that calling repaintCanvas()
is even doing something with dimensions. With or without calling repaintCanvas()
it works the same.
Looks like node is getting updated if I console.log
dimensions after updating them in my updateDimenions method
, but they are not getting passed to render function.
@smashboy did you find solution?
@ilyaborodin Yes, it is a weird one. My NodeWidget component is wrapped in mobx observer and because of that new props were not passed to NodeWidget. So I've had to make observable part as a separate component in order to get new props. Btw not only dimensions were not getting updated, other props were not getting updated too.
I'm trying to build dynamic nodes, but I'm not able to call updateDimensions multiple times. Width and height won't update on second call.