Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce dependence on Recoil and useEntities() #770

Merged
merged 6 commits into from
Jan 29, 2025

Conversation

kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented Jan 28, 2025

Description

Moves manipulation of the entitiesSelector Recoil state behind domain specific hooks. This will aid in the switch to entity ID as a base for the graph.

  • Add useExplorer() hook to abstract away dependency on Recoil
  • Update useAllNeighbors() hook to get the graph entities internally
  • Add useClearGraph() to remove all entities from the graph (used in GraphViewer and ContextMenu)
  • Update useRemoveFromGraph() to push the parameters in to the callback function
    • Updated the convenience hooks to call the one main hook
  • Update useAddToGraph() to pass the entities to the callback
    • Change the convenience hook useAddVertexToGraph() to us the main hook
    • Ensure useExpandNode() uses useAddToGraph()
  • For neighbor count and expansion queries, get the expansion limit set on the connection from the explorer object passed in

Validation

  • Verified expansion limit set in the connection
    • This seems buggy, but I compared it to what was there before and it is the same behavior. I'm not exactly sure what the behavior should be, so I'm leaving it as is.
  • Verified all query languages
  • Verified clearing the graph
  • Verified removing nodes
  • Verified expansion

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0
    license.
  • I have run pnpm checks to ensure code compiles and meets standards.
  • I have run pnpm test to check if all tests are passing.
  • I have covered new added functionality with unit tests if necessary.
  • I have added an entry in the Changelog.md.

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 43.30357% with 127 lines in your changes missing coverage. Please review.

Project coverage is 20.89%. Comparing base (9d3a2b7) to head (36103e0).
Report is 79 commits behind head on main.

Files with missing lines Patch % Lines
...ackages/graph-explorer/src/hooks/useExpandNode.tsx 0.00% 20 Missing ⚠️
packages/graph-explorer/src/connector/queries.ts 26.31% 14 Missing ⚠️
...lorer/src/modules/NodeExpand/NodeExpandContent.tsx 0.00% 13 Missing ⚠️
...les/GraphViewer/internalComponents/ContextMenu.tsx 0.00% 9 Missing ⚠️
...graph-explorer/src/core/StateProvider/neighbors.ts 42.85% 8 Missing ⚠️
packages/graph-explorer/src/hooks/useAddToGraph.ts 68.18% 7 Missing ⚠️
...src/modules/common/NeighborsList/NeighborsList.tsx 0.00% 6 Missing ⚠️
...ph-explorer/src/connector/sparql/sparqlExplorer.ts 0.00% 5 Missing ⚠️
...aph-explorer/src/connector/sparql/vertexDetails.ts 0.00% 4 Missing ⚠️
...h-explorer/src/modules/GraphViewer/GraphViewer.tsx 0.00% 4 Missing ⚠️
... and 20 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #770      +/-   ##
==========================================
+ Coverage   14.88%   20.89%   +6.00%     
==========================================
  Files         566      525      -41     
  Lines       25121    22366    -2755     
  Branches     1170     1203      +33     
==========================================
+ Hits         3739     4673     +934     
+ Misses      21050    17445    -3605     
+ Partials      332      248      -84     
Flag Coverage Δ
unittests 20.89% <43.30%> (+6.00%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kmcginnes kmcginnes marked this pull request as ready for review January 29, 2025 15:46
@andreachild
Copy link

LGTM

@kmcginnes kmcginnes merged commit 1c30d87 into aws:main Jan 29, 2025
1 check passed
@kmcginnes kmcginnes deleted the refactor-hooks branch January 29, 2025 18:17
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.

2 participants