-
Notifications
You must be signed in to change notification settings - Fork 357
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
refactor: consolidate experiment list selection state #8860
Conversation
✅ Deploy Preview for determined-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
5054cc5
to
6334dee
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8860 +/- ##
==========================================
- Coverage 47.48% 42.84% -4.65%
==========================================
Files 1168 849 -319
Lines 176317 137164 -39153
Branches 2351 2385 +34
==========================================
- Hits 83729 58771 -24958
+ Misses 92430 78235 -14195
Partials 158 158
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
I'm still working my way through the code, but I found some problems while running through the test plan.
- Going to the second page and reloading brings me back to first page
- Changing query param to
compare=false
didn’t work, it changed itself back totrue
and comparison view stayed open - Holding shift while selecting an experiment didn’t seem to do anything; either way any selections off the page got replaced
- Similarly. if I select all experiments, deselect one (A), switch pages, and deselect another experiment (B), the first experiment I deselected (A) gets re-selected
@EmilyBonar just pushed a fix that should address selections across pages and the compare param not persisting properly. This should also mitigate one source of the page being reset. could you confirm when you have the time? |
The compare view and deselection across pages (bullet point 4) bugs are fixed. The bug with the page number getting reset on refresh is still present. I'm still not entirely sure what the shift behavior is supposed to be, but when I follow this section of the test plan:
The selection status shows that 2 experiments are selected, and the next experiment seems to be added to the selection whether or not shift is held. |
e42bf9c
to
68a5c6d
Compare
updated the test plan -- i was thinking of the native glide table selection behavior, i've replaced it with how shift selections work currently. I've also pushed a potential fix for the page being reset by changing how we detect if the scroll took (previously we assumed that the table would be set up after a certain amount of renders with the glide table mounted, now we wait for the row in question to be in bounds) can you verify? |
The page reset bug is fixed! The only step of the test plan I'm still having trouble with is
When I reach that step I see "2 of [total] experiments selected" |
@EmilyBonar updated the test plans again -- looking at the main branch that behavior is acceptable. |
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.
Test plan passes and everything looks good! Just some code style comments
cleanup = projectSettingsObs.subscribe((ps) => { | ||
if (ps.isLoaded) { | ||
cleanup(); | ||
initFormset(ps); | ||
} | ||
}); |
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.
nit: this part is hard to follow, a comment would be helpful.
@@ -293,6 +316,36 @@ const F_ExperimentList: React.FC<Props> = ({ project }) => { | |||
// eslint-disable-next-line react-hooks/exhaustive-deps | |||
}, [isLoadingSettings]); | |||
|
|||
useEffect(() => { |
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.
nit: this whole useEffect could use more commenting
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.
will probably refactor this pattern to be clearer -- it's the same setup as the formset effect, but it's very verbose and we're doing a weird thing with the cleanup reference in order to get around subscribe
only being called when the observable changes.
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.
Yeah, it's confusing in the other spot too, especially the cleanup
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.
@EmilyBonar refactored the effects -- is this easier to understand?
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.
Yeah that's a lot better, thanks!
This refactors some items related to the experiment list selection ahead of fixing the bulk action apis: 1) selection state (selected/excluded experiment ids, selectAll state) is consolidated into a single object. Previously, selected experiment ids, excluded experiment ids, and the selectall state were stored separately. This is problematic -- because the selected experiment ids were the source of truth for which experiments were selected, the stored list would grow as the user paged through the results when in selectall mode. we now determine the final list of selected elements on the fly. 2) grid selection is now fully determined from the id selection. previously, the grid selection and id selection were maintained separately. this required a lot of code ensuring they stayed in sync. we now only derive the grid selection from the selected id list. 3) handleSelectionChange now no longer requires row ranges in an `add-all` or `remove-all` change type. this allows for functions and effects that solely dealt with these change types to no longer rely on the experiments array. 4) project experiment list settings is no longer using useSettings. because the grid selection only updates when the settings updates, the act of updating the selection felt worse when using useSettings. we now directly interface with the settings store at the project level -- global settings still use useSettings. 5) new hook: useTypedParams. In order to keep the functionality of the `compare` parameter, we introduce a useTypedParams hook which allows typesafe parsing and setting of query params similar to the settings store api. this should allow us to finally fully migrate off of useSettings.
647390e
to
5748bf4
Compare
This refactors some items related to the experiment list selection ahead of fixing the bulk action apis: 1) selection state (selected/excluded experiment ids, selectAll state) is consolidated into a single object. Previously, selected experiment ids, excluded experiment ids, and the selectall state were stored separately. This is problematic -- because the selected experiment ids were the source of truth for which experiments were selected, the stored list would grow as the user paged through the results when in selectall mode. we now determine the final list of selected elements on the fly. 2) grid selection is now fully determined from the id selection. previously, the grid selection and id selection were maintained separately. this required a lot of code ensuring they stayed in sync. we now only derive the grid selection from the selected id list. 3) handleSelectionChange now no longer requires row ranges in an `add-all` or `remove-all` change type. this allows for functions and effects that solely dealt with these change types to no longer rely on the experiments array. 4) project experiment list settings is no longer using useSettings. because the grid selection only updates when the settings updates, the act of updating the selection felt worse when using useSettings. we now directly interface with the settings store at the project level -- global settings still use useSettings. 5) new hook: useTypedParams. In order to keep the functionality of the `compare` parameter, we introduce a useTypedParams hook which allows typesafe parsing and setting of query params similar to the settings store api. this should allow us to finally fully migrate off of useSettings.
Description
This refactors some items related to the experiment list selection ahead of fixing the bulk action apis:
selection state (selected/excluded experiment ids, selectAll state) is consolidated into a single object. Previously, selected experiment ids, excluded experiment ids, and the selectall state were stored separately. This is problematic -- because the selected experiment ids were the source of truth for which experiments were selected, the stored list would grow as the user paged through the results when in selectall mode. we now determine the final list of selected elements on the fly.
grid selection is now fully determined from the id selection. previously, the grid selection and id selection were maintained separately. this required a lot of code ensuring they stayed in sync. we now only derive the grid selection from the selected id list.
handleSelectionChange now no longer requires row ranges for
add-all
orremove-all
change types. this allows for functions and effects that solely dealt with these change types to no longer rely on the experiments array.project experiment list settings is no longer using useSettings. because the grid selection now only updates when the settings updates, the act of updating the selection felt slower than when using useSettings. we now directly interface with the settings store at the project level -- global settings still use useSettings.
new hook: useTypedParams. In order to keep the functionality of the
compare
parameter, we introduce a useTypedParams hook which allows typesafe parsing and setting of query params similar to the settings store api. this should allow us to finally fully migrate off of useSettings.Test Plan
Parameter/setttings behavior:
page=1
compare=true
compare=true
and reload the pagecompare=false
and reload the pageSelection behavior:
Checklist
docs/release-notes/
.See Release Note for details.
Ticket
this is base work for WEB-1937