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

KANBAN-591 #1391

Open
wants to merge 12 commits into
base: test
Choose a base branch
from
Open

KANBAN-591 #1391

wants to merge 12 commits into from

Conversation

adamgibs
Copy link
Contributor

TESTING -- DO NOT MERGE

Copy link

@sethrcamp sethrcamp left a comment

Choose a reason for hiding this comment

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

Left a few thoughts, but overall looks pretty straight forward (although I am sure it looks much more straightforward than it was to actually upgrade everything).

@@ -108,7 +109,7 @@ const OrthologPicker =({
selectedOrthologs = selectedOrthologs?.filter(bySpecies(selectedSpecies));
}
}
onChange(selectedOrthologs);
onChange(selectedOrthologs || []);

Choose a reason for hiding this comment

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

I think you can get away with:

if (checkboxValue && orthology.data.results)

on line 102. That should also let you get rid of the "?" chains for lines 103, 106, and 109.

@@ -58,7 +58,7 @@ const ExpressionComparisonRibbon = ({
let updatedSummary;
if (summary.data) {
const taxonIdYeast = 'NCBITaxon:559292';
const categories = summary.data.categories.filter(category => !(
const categories = summary.data?.categories?.filter(category => !(

Choose a reason for hiding this comment

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

A few thoughts here:

  1. Since this is wrapped in if (summary.data), then you shouldn't need the first "?" (i.e. `summary.data.categories?..."

  2. "categories" can be undefined if data.categories is undefined. Just curious if this is intentional.

  3. This is a pretty minor optimization, but both "selectedOrthologs" and "geneTaxon" are not dependant on the categories array, meaning selectedOrthologs.length === 0 && geneTaxon === taxonIdYeast will be the same for every category. Rewriting it this way will reduce the number of times the comparison will be made to 1 (or O(1) to be fancy):

let updatedSummary;
if (summary.data) {
  const taxonIdYeast = 'NCBITaxon:559292';
  let categories = summary.data.categories;
  if (categories && selectedOrthologs.length === 0 && geneTaxon === taxonIdYeast) {
    categories = categories.filter(category => !category.id.startsWith('UBERON:');
  }
  ...
}
  1. Lastly, updatedSummary = summary.data; will be a pointer reference, meaning updatedSummary.categories = categories; will change the value for both "summary" and "updatedSummary". I don't recall if react query supports this, but either way, if this isn't intentional, I would change to this instead:
updatedSummary = {
  ...summary.data,
  categories
};

isLoading,
} = tableProps;

const data = useMemo(() => {
return resolvedData ? resolvedData.results?.map(allele => ({
return resolvedData ? resolvedData?.map(allele => ({

Choose a reason for hiding this comment

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

Here's a little shorthand if you like avoiding ternaries:

return (resolvedData || []).map(allele => ... );

@motenko motenko added the don't merge Wait for author's confirmation before merging. label Jan 16, 2025
@adamgibs
Copy link
Contributor Author

@sethrcamp Pushed out code to address your comments. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
don't merge Wait for author's confirmation before merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants