reaviz / reagraph

🕸 WebGL Graph Visualizations for React. Maintained by @goodcodeus.

Home Page:https://reagraph.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initial selection does not follow pathSelectionType

TathagataChakraborti opened this issue · comments

Describe the bug

The first render with a list of selected nodes, before clicking a button, only highlights the nodes and does not follow the "in" or "out" pathSelectionType option to highlight the correct links.

Coupled with no option to color edges, as brought up in the discussion here, there seems to be no way to initialize a partially selected graph correctly.

Steps to Reproduce the Bug or Issue

Invoke the Canvas element with a non-empty selections as input and pathSelectionType set to "in" or "out".

Expected behavior

I was expecting the pathSelectionType formatting to be enforced on the initial rendering but only nodes are highlighted.

Screenshots or Videos

Screenshot 2023-05-18 at 23 24 15

Platform

  • Reagraph Version: 4.8.2
  • OS: macOS
  • Browser: Chrome
  • React version: 18.1.0

Your Example Website or App

No response

Additional context

All I am looking for is more control over the edges really. So if there is a way to format it instead manually instead of using the useSelection hook then that will be best.

commented

Do you see an error in the console? I believe this is because the graph isn't initialized at the time it tries to select thus the issue. https://github.com/reaviz/reagraph/blob/master/src/selection/useSelection.ts#L396

You could probably solve this in a work around by doing a mount effect and setting it there rather than as a initial prop.

commented

@TathagataChakraborti - Can you retest this? We swapped the graph engine and this should work now.

@amcdnl Sorry about the delay. I am on travel atm, but will be back late next week and test. 👍