projectstorm / react-diagrams

a super simple, no-nonsense diagramming library written in react that just works
https://projectstorm.cloud/react-diagrams
MIT License
8.69k stars 1.18k forks source link

Crash when using smart routing #377

Open deltakosh opened 5 years ago

deltakosh commented 5 years ago

Hey!

I've got this error when using smart routing:

Uncaught TypeError: Cannot set property 'g' of undefined
    at JPFNeverMoveDiagonally.JumpPointFinderBase.findPath (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:61210)
    at PathFinding.calculateDirectPath (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:61210)
    at DefaultLinkWidget.render (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:61210)
    at finishClassComponent (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:52291)
    at updateClassComponent (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:52254)
    at beginWork (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:53072)
    at performUnitOfWork (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:55810)
    at workLoop (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:55850)
    at renderRoot (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:55936)
    at performWorkOnRoot (:1338/.temp/localDevUMD/nodeEditor/babylon.nodeEditor.js:56827)

If I turn smart routing off, it works flawlessly

Here is our setup (with smart routing off): https://github.com/BabylonJS/Babylon.js/blob/master/nodeEditor/src/graphEditor.tsx#L528

Thanks a lot!

dylanvorster commented 5 years ago

Oh wow, its now in a game engine O_O I am busy reworking the entire smart routing system as we speak. The new system introduces smart routing as a new type of Link. I hope to have something out in the next few days, and this might solve your issue. If not, I'm really interested in working with you to help make this a success in your project.

dylanvorster commented 5 years ago

to follow the progress, head on over to https://gitter.im/projectstorm/react-diagrams

dylanvorster commented 5 years ago

Also the new structure of the project: https://github.com/projectstorm/react-diagrams/tree/lerna (you will be interested in the lib-routing folder)

deltakosh commented 5 years ago

Man we love your library:) image

deltakosh commented 5 years ago

What should I do to switch to the new project? (using 5.2.1 for now) Your tool will be a central piece of our 4.1 release as it will fuel our Node Material system :)

So glad we can work together

dylanvorster commented 5 years ago

Definitely getting some blender comp-pipeline and Unreal-engine vibes in that screenshot. Ill let you know as soon I have something available

dylanvorster commented 5 years ago

Im also busy fixing the link issue (the one where it doesnt respect horizonal mode)

deltakosh commented 5 years ago

Clearly:) feel free to ping me at david@catuhe.com if you want to chat!

dylanvorster commented 5 years ago

New fixes rolling out soon:

Screenshot 2019-07-27 at 16 11 52 Screenshot 2019-07-27 at 16 10 58 Screenshot 2019-07-27 at 16 10 05

You can specify the alignment of a port (top, left, bottom, right etc..)

deltakosh commented 5 years ago

Exactly what we need!!!

dylanvorster commented 5 years ago

update from my side:

dylanvorster commented 5 years ago

if you check out the lerna branch, run yarn in the root and then head to the lib-demo-gallery you can run yarn start and then you should get the new demos. Ive been giving this some thought, and I wouldn't mind getting involved in upgrading your current implementation in Babylone.js when this releases

deltakosh commented 5 years ago

Oh man I did not dare asking but we will be honored to get your help on using your lib the best possible way

dylanvorster commented 5 years ago

So version 6 [Beta] is now out, and I would love to get your thoughts on the new system. I also have smart routing working again (the original issue in this ticket). Let me know!

deltakosh commented 5 years ago

Yeah!!! It is on npm right?

deltakosh commented 5 years ago

Well I have a few issues when moving to 6.0.0. Mostly breaking changes :( Some examples:

Do you have a doc or a way to help me port our code? I created that branch https://github.com/BabylonJS/Babylon.js/tree/projectstorm. If you want to have a look:

dylanvorster commented 5 years ago

Most of the stuff you listed is still in the library, we just made the API more consistent:

I am still busy writing docs including a migration guide, so stay tuned

deltakosh commented 5 years ago

Perfect !! Will give it a try asap

dylanvorster commented 5 years ago

If you need faster assistance, feel free to message me here https://gitter.im/projectstorm/react-diagrams

deltakosh commented 5 years ago

Ok so more questions :)

zacharyzhy commented 5 years ago

@deltakosh I've seen the same nodeUpdated type error. The temporary workaround is to cast it to the type you need, like

.registerListener({
  nodesUpdated: () => {}
} as DiagramListener)
deltakosh commented 5 years ago

Wonderful! Still blocked on the other issue though

deltakosh commented 5 years ago

Any news, team?

deltakosh commented 5 years ago

Well just in case, we started doing some videos using your lib:

deltakosh commented 5 years ago

up?

yanghoxom commented 5 years ago

@deltakosh @dylanvorster i'm using 5.2.1 verrsion and also get this error in some device anyone has suggest for fix it ? i hope i can keep smart routing on

TranVanKung commented 5 years ago

@memsenpai same for me. By the way, I am Vietnamese =))