-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes bugs in the medium severity column. Each commit should have a description of the bug it fixes and what a link to the issue ## Meets all label This is a hacky fix that we needed to do to add the `Meets All` label under the available files filter. It works by using some React state to control whether the label should be visible or not, and we update the state before we update the query parameter. We do this separately because updating the query parameter state also triggers a refetch, meaning the label won't be visible until ## Optimize revalidation + Default data loaders This should hopefully fix the amount of flashing errors we see on the frontend. The first thing I did was optimize revalidation by adding a [shouldRevalidate()](https://remix.run/docs/en/main/route/should-revalidate) for various pages so that we only refetch data when a required parameter has changed. In the past, we would always refetch even if it wasn't related to the query. For example, opening the metadata drawer or switching tabs on the download modal all triggered refetches. The second thing I did was add default data for the mock data used when loading the tables. Before to create mock data, we were passing empty objects and type casting them as the data object: https://github.com/chanzuckerberg/cryoet-data-portal/blob/5bc0f0b607b2959f6acfb017b64ba48d25a49e7f/frontend/packages/data-portal/app/components/Run/AnnotationTable.tsx#L21 Now we provide empty defaults to the fields that are specified as required in the interface: https://github.com/chanzuckerberg/cryoet-data-portal/blob/388c816bd2a3524174471fe245ac25c58e7674c2/frontend/packages/data-portal/app/components/Run/AnnotationTable.tsx#L21-L37 This should fix the flashing errors because the errors were originally caused because the frontend was trying to access data that didn't exist. This usually happens whenever the page is refetching data and for a split second, it tries rendering the invalid loading data. By reducing the refetching + adding default data, we should: 1. Reduce the amount of refetches while using the app so that the flashing errors don't occur 2. Add default data so that all data access is safe and using data that exists ## Fix filters To fix the filters, I used the `_and` and `_or` fields to implement the desired logic. Every filter is pushed into a filters array with its specified filter condition: https://github.com/chanzuckerberg/cryoet-data-portal/blob/388c816bd2a3524174471fe245ac25c58e7674c2/frontend/packages/data-portal/app/routes/browse-data.datasets.tsx#L121-L130 We implement the filters with an OR condition by nesting an `_or` field: https://github.com/chanzuckerberg/cryoet-data-portal/blob/388c816bd2a3524174471fe245ac25c58e7674c2/frontend/packages/data-portal/app/routes/browse-data.datasets.tsx#L216-L227 https://github.com/chanzuckerberg/cryoet-data-portal/blob/388c816bd2a3524174471fe245ac25c58e7674c2/frontend/packages/data-portal/app/routes/browse-data.datasets.tsx#L249-L251
- Loading branch information
1 parent
5bc0f0b
commit ac81d47
Showing
14 changed files
with
368 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.