Skip to content

fix: pixi v8 related issues

Dennis Collaris requested to merge fix/pixiv8 into main

Even though I like the previous approach of creating the pixi application asynchronously first, THEN rendering the NLPixi component, this caused various issues down the line. I think the await on app.init() returns too early, because ticker would be non existent later on in the chain of events (even though we explicitly checked for it to exist before rendering the NLPixi component. As an alternative, this PR uses a custom useAsyncMemo to memoize the application within the component itself, and waits with the setup until its ready. This works and introduces fewer bugs.

During fixing, I touched quite some parts of the NL, and ended up fixing a bunch of things. I would have much rather made these separate PRs, but the changes were needed soon so its all here now:

  • This also tweaks the nodelink for larger graphs, and fixed the previously broken logic to stop the layouter when nodes are not moving anymore.

  • Another fix is the edge labels which were broken before (even prior to pixi v8) but are fixed now.

  • Next, it also ensures that the tooltip is moving along when the layouter is running. This previously caused tooltips to be in the wrong spot as nodes were still moving.

  • I believe resize was never working correctly because the resizeobserver was immediately removed (at least in development), but thats fixed too.

A problem we encountered was that on Chrome every so often (and Firefox pretty much all the time) pixi would show a blank screen. When resizing you could see a quick glimpse of the node link, so continuously resizing revealed the nodelink. All the nodes would be there, every interaction works, even tooltips show up and would pan when interacting. I tried a lot of different approaches, but none of our own code seems responsible for this. Leo and I figured out that stopping and starting the timer would fix the problem. Our eventual solution was to not autostart the timer, but start it ourselves after we added the ticker. This circumvented this (probably timing/race condition) issue and it works reliably.

Edited by Dennis Collaris

Merge request reports

Loading