-
Notifications
You must be signed in to change notification settings - Fork 48
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
Improve node and edge filter options #289
Conversation
I'm looking in to the type check failure |
Ok, I was able to fix this by installing the I have no idea why it was working locally. I must have had that module cached or something. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #289 +/- ##
==========================================
+ Coverage 12.15% 13.95% +1.79%
==========================================
Files 411 414 +3
Lines 30575 30762 +187
Branches 776 878 +102
==========================================
+ Hits 3717 4293 +576
+ Misses 26525 26139 -386
+ Partials 333 330 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Reduce filter config resets
We were manually reseting the filter options every time the schema nodes and edges change, which is triggered by expanding a node. This is because the schema may change when we get back the neighbors of the expanded node. Those new node or edge types should be added to the schema, and therefore the filter options.
However, we don't want to reset the filter options on expansion. So instead of storing the list of visible nodes and edges in the filter state I changed it to store the hidden items. This means the default state with all nodes and edges selected is an empty array.
We no longer need to update the stored filter options when the schema changes because of an expansion. Any new types will be selected automatically. Any unselected items will remain unselected.
The filters properly reset when the connection changes.
Sidebar badge for filters
There is a chance for user confusion with the filter reset change above.
Let's say you have filtered out all but one node type. Now you expand that node. Nothing in the UI will change since you have all the other node types hidden.
To make it more obvious that a filter is applied, I've added a badge to the filter sidebar button. It will show any time a node or edge is unselected.
Testing
I discovered the reason why testing the React hooks was causing Jest to fail to run the tests. The drag and drop library we add to the app through React context is exported by the
/core/index.ts
file. Simply importing from/core/index.ts
would cause running the tests to fail, preventing us from properly testing the hook logic.By changing how we import some of the types, and removing
ConnectedProvider
fromindex.ts
writing tests for the hooks became much simpler.I've also added some data generation helpers. They can create random data in general, and random schemas specifically. This helps in test setup for the majority of our logic, since the schema and config is typically the starting point for our logic.
Validation
Verify filters remain when expanding
Verify filters reset when changing configs
Verify filter badge
Related Issues
Check List
pnpm run checks
to ensure code compiles and meets standards.pnpm run test
to check if all tests are passing.