aws / graph-explorer

React-based web application that enables users to visualize both property graph and RDF data and explore connections between data without having to write graph queries.
https://github.com/aws/graph-explorer
Apache License 2.0
299 stars 46 forks source link

Move node count logic to one place #434

Closed kmcginnes closed 3 weeks ago

kmcginnes commented 3 weeks ago

Description

This change pulls all queries related to getting the neighbor counts to a single place. It watches for changes to the list of nodes in the graph. When a node is added we execute a query for that nodeId.

Neighbor expansion is also a React Query now. It is hosted in a React context to share the expand request state. This ensures a single expand is allowed to execute at any one time. And it also allows better control over notifications to the user so there is only one error notification and one progress notification. I would've used Recoil state instead, but I ran in to problems with that approach.

I also removed the limit parameter when executing the callback from useFetchNode(). This limit was fairly pointless since it only affected that one node, not any future nodes. And the behavior was strange. In search it would limit to 500 when the check box is checked. In the DataExplorer it will limit the added node to the page size.

Validation

Related Issues

Check List

kmcginnes commented 3 weeks ago

@vkagamlyk I think this is ready for another look. I have no more planned changes.