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

CRDCDH-1608 Create column filtering for tables and add filters to Data Submission List table #476

Merged
merged 57 commits into from
Oct 10, 2024

Conversation

Alejandro-Vega
Copy link
Collaborator

@Alejandro-Vega Alejandro-Vega commented Sep 26, 2024

Overview

Added ability to toggle column visibility on Data Submission List table. Also added additional filters to narrow down search.

Change Details (Specifics)

  • Added column visibility button and popper to make it easily reusable
  • Added show all and reset buttons for the column visibility popper
  • Created hook to manage column visibility and to handle the logic of hideable columns as well as managing local storage.
  • Separated filter logic out of the Data Submission list view component and added new filters for Data Commons, Submission Name, dbGaP ID, and Submitters
  • Retrieved list of Data Commons and submitters from API to populate dropdowns
  • Added debounce to text inputs after 3 characters are typed and delay is 0.5s. (Ticket says 0.1s, but I increased it to match other debounce fields, I left comment in ticket)
  • Added reset button which resets the state of all filters and removes the search params from the URL, but still keeps the search params for the table state (ex. page number, rows per page, etc.)
  • Maintain filter state in the URL where it will persists between refreshes. It will also be restored if you click into a data submission and click back
  • Fixed bug with Manage users and Manage orgs list tables. If you navigated to a page other than 1, then changed the filters, it would show a weird table which is due to the page number not properly resetting on filter change
  • Fixed bug with Manage orgs table where it was missing a dep for the "study" filter which caused it not always to apply the filter to the table. I added the missing dependency to fix the issue
  • Update default rows per page of table to 20
  • A side-effect of filtering by Submitters and having those submitterNames being filtered by the other filters, is that if another filter changes then the name may no longer be a valid name. This will cause the Submitter dropdown reset back to "All". In order to check if the name is valid with the new filters, it makes 2 API calls instead of just the 1.

Note

Sorting for list of Data Commons and Submitters will be done on the BE.

Related Ticket(s)

CRDCDH-1608 (Task)
CRDCDH-1586 (User Story)

@Alejandro-Vega Alejandro-Vega added this to the 3.1.0 (PMVP-M2) milestone Sep 26, 2024
@coveralls

This comment was marked as outdated.

@Alejandro-Vega Alejandro-Vega added the 🚧 Do Not Merge This PR is not ready for merging label Sep 26, 2024
@Alejandro-Vega Alejandro-Vega changed the title CRDCDH-1608 Create column filtering for tables CRDCDH-1608 Create column filtering for tables and add filters to Data Submission List table Oct 9, 2024
@Alejandro-Vega Alejandro-Vega added the 🚧 Do Not Merge This PR is not ready for merging label Oct 9, 2024
@amattu2
Copy link
Member

amattu2 commented Oct 9, 2024

@amattu2 If you have time, can you check to see if maybe your tests are being a bit laggy by re-running them, or if the site is a big laggy. It could just be my device, but I can't tell. I checked for memory leaks on the browser and it seems fine. The test heap sizes are pretty big for quite a few of them, but unsure if related. If it all seems good on your side, then disregard this.

It looks like the run time for Jest in CI has jumped ~10s in this PR. If you added a lot of tests that use async with waitFor then this is probably to be expected, especially since I limited the number of tests that can run in parallel (#454). Locally, however, the run time has only increased like 1 second at most (approx. 35s total).

Last 3.1.0 run

Screenshot 2024-10-09 at 3 31 26 PM

Last run in this branch

Screenshot 2024-10-09 at 3 32 03 PM

Anecdotally, Jest has always randomly bogged down for me locally, but it disappears usually after rebooting.

@Alejandro-Vega Alejandro-Vega removed the 🚧 Do Not Merge This PR is not ready for merging label Oct 9, 2024
Copy link
Member

@amattu2 amattu2 left a comment

Choose a reason for hiding this comment

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

A few questions and suggestions are annotated below. In general, most of them are optional.

src/hooks/useLocalStorage.ts Outdated Show resolved Hide resolved
src/graphql/listSubmissions.ts Outdated Show resolved Hide resolved
src/components/GenericTable/ColumnVisibilityButton.tsx Outdated Show resolved Hide resolved
src/content/dataSubmissions/DataSubmissionsListView.tsx Outdated Show resolved Hide resolved
src/hooks/useLocalStorage.ts Show resolved Hide resolved
src/hooks/useLocalStorage.ts Outdated Show resolved Hide resolved
@amattu2
Copy link
Member

amattu2 commented Oct 10, 2024

As a side note, not directly related to this PR, the GenericTable does a lot of rerendering during the initial display of rows and subsequently causes all of the nested components to rerender with it. At some point, we should attempt to stabilize it more with stronger memoization for props/etc.

Just a potential QoL improvement for the future (maybe 3.2.0).

@amattu2 amattu2 added the 📝 Change Requested This PR has requested changes label Oct 10, 2024
@Alejandro-Vega
Copy link
Collaborator Author

As a side note, not directly related to this PR, the GenericTable does a lot of rerendering during the initial display of rows and subsequently causes all of the nested components to rerender with it. At some point, we should attempt to stabilize it more with stronger memoization for props/etc.

Just a potential QoL improvement for the future (maybe 3.2.0).

Agreed, unfortunately I let it get out of hand. The table is becoming quite a mess. It is in need of some strong refactoring, but will be quite the lift. Fixing the re-rendering problem is definitely a good start.

@Alejandro-Vega Alejandro-Vega removed the 📝 Change Requested This PR has requested changes label Oct 10, 2024
Copy link
Member

@amattu2 amattu2 left a comment

Choose a reason for hiding this comment

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

LGTM.

@amattu2
Copy link
Member

amattu2 commented Oct 10, 2024

Skipping updating the branch, only minor changes in 3.1.0.

@amattu2 amattu2 merged commit e0abe13 into 3.1.0 Oct 10, 2024
5 checks passed
@amattu2 amattu2 deleted the CRDCDH-1608 branch October 10, 2024 19:53
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.

3 participants