Skip to content

Conversation

@mykalmax
Copy link
Member

@mykalmax mykalmax commented Feb 16, 2023

Screenshot 2023-02-16 at 5 53 33 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dagre's deprecated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in example , so I used it just to make it work for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not use dagre, even for an example

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I used https://github.com/kieler/elkjs, since we only need a graph layout engine but vis-network seems like a draw library

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@mykalmax mykalmax marked this pull request as ready for review February 17, 2023 01:10
@vchan
Copy link
Contributor

vchan commented Feb 17, 2023

For these kind of UI changes, would it be possible to attach a screenshot, or even an animated GIF, of the changes to the PR?

@router.get("/dag")
async def dag(
context: Context = Depends(get_loaded_context),
) -> t.Dict[str, t.Any]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
) -> t.Dict[str, t.Any]:
) -> t.Dict[str, t.List[str]]:

}

async function load(): Promise<void> {
setGraph(undefined)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset graph object in case getNodesAndEdges fails

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the graph object is reset? Is the effect hook below the only place that is affected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should trigger re-render , so if getNodesAndEdges takes very long time to finish , we may want to show spinner (or skeleton) before new state for graph is set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the graph object is set to undefined, it won't trigger a re-render because the effect hook below returns if graph is null/undefined, right?


const graph = await getNodesAndEdges({ data, algorithm })

if (isFalse(active)) return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this happen before calling getNodesAndEdges()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our load is async and runs off thread kinda, so if getNodesAndEdges takes too long and we close dag before it finished if (isFalse(active)) return will prevent from changing state after getNodesAndEdges done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thank you for the explanation.

@mykalmax mykalmax merged commit da59a6e into main Feb 17, 2023
@mykalmax mykalmax deleted the max/ui_graph branch February 17, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants