gramene-search 2.5.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -634,11 +634,16 @@ const $9d9aeaf9299e61a1$var$grameneTaxDist = {
634
634
  };
635
635
  },
636
636
  selectGrameneTaxDist: (0, $gXNCa$reduxbundler.createSelector)('selectGrameneSearch', 'selectGrameneTaxonomy', 'selectGrameneMaps', (grameneSearch, grameneTaxonomy, grameneMaps)=>{
637
- if (grameneSearch && grameneTaxonomy && grameneMaps) {
637
+ // The bin facet can be absent during a saved-view restore (a search is
638
+ // present but its faceted response with `fixed_1000__bin` hasn't landed
639
+ // yet, or a non-faceted search is transiently in state). Bail to null
640
+ // until it's there rather than crashing on `a.length`.
641
+ const binFacet = grameneSearch && grameneSearch.facet_counts && grameneSearch.facet_counts.facet_fields && grameneSearch.facet_counts.facet_fields.fixed_1000__bin;
642
+ if (binFacet && grameneTaxonomy && grameneMaps) {
638
643
  (0, ($parcel$interopDefault($gXNCa$lodash))).forIn(grameneMaps, (map, tid)=>{
639
- grameneTaxonomy[tid].name = map.display_name;
644
+ if (grameneTaxonomy[tid]) grameneTaxonomy[tid].name = map.display_name;
640
645
  });
641
- const binnedResults = $9d9aeaf9299e61a1$var$formatFacetCountsForViz(grameneSearch.facet_counts.facet_fields.fixed_1000__bin);
646
+ const binnedResults = $9d9aeaf9299e61a1$var$formatFacetCountsForViz(binFacet);
642
647
  let speciesTree = (0, ($parcel$interopDefault($gXNCa$gramenetreesclientsrctaxonomy))).tree(Object.values(grameneTaxonomy));
643
648
  let binMapper = (0, ($parcel$interopDefault($gXNCa$gramenebinsclientsrcbins)))(grameneMaps);
644
649
  let taxDist = (0, $gXNCa$gramenetaxonomywithgenomes.build)(binMapper, speciesTree);
@@ -1618,6 +1623,9 @@ const $24971af0a229e0e3$var$grameneViews = {
1618
1623
  const touched = raw.touched || {};
1619
1624
  const numFound = search && search.response && search.response.numFound || 0;
1620
1625
  const hasFilters = !!(filters && filters.rightIdx > 1);
1626
+ // Views whose content depends on a current search: auto-off when no
1627
+ // filters are set or no results came back. userLists is deliberately
1628
+ // NOT here — it's user-owned and meaningful regardless of search state.
1621
1629
  const resultDependentIds = new Set([
1622
1630
  'taxonomy',
1623
1631
  'taxTree',
@@ -17943,8 +17951,8 @@ function $15504f5eba8e73bd$var$computeSelectedTaxa({ grameneSearch: grameneSearc
17943
17951
  const selected = {};
17944
17952
  if (!grameneSearch) return selected;
17945
17953
  if (collapseEmpties) {
17946
- const tids = grameneSearch.facet_counts.facet_fields.taxon_id;
17947
- for(let i = 0; i < tids.length; i += 2)selected[tids[i]] = true;
17954
+ const tids = grameneSearch.facet_counts && grameneSearch.facet_counts.facet_fields && grameneSearch.facet_counts.facet_fields.taxon_id;
17955
+ if (tids) for(let i = 0; i < tids.length; i += 2)selected[tids[i]] = true;
17948
17956
  } else {
17949
17957
  const active = grameneGenomes && grameneGenomes.active || {};
17950
17958
  if (Object.keys(active).length === 0 && grameneMaps) Object.keys(grameneMaps).forEach((tid)=>{
@@ -17997,7 +18005,7 @@ const $15504f5eba8e73bd$var$TaxDistTbrowse = (props)=>{
17997
18005
  doAcceptGrameneSuggestion
17998
18006
  ]);
17999
18007
  const hostData = (0, $gXNCa$react.useMemo)(()=>{
18000
- const facet = props.grameneSearch && props.grameneSearch.facet_counts && props.grameneSearch.facet_counts.facet_fields.taxon_id;
18008
+ const facet = props.grameneSearch && props.grameneSearch.facet_counts && props.grameneSearch.facet_counts.facet_fields && props.grameneSearch.facet_counts.facet_fields.taxon_id;
18001
18009
  return {
18002
18010
  bins: (0, $bfd29d54a0f0e853$export$390e10a52782f018)(grameneTaxDist),
18003
18011
  geneCounts: adapter ? (0, $15275c4f5939e11d$export$ce87f9041549c2e9)(adapter.tree, facet) : null,