ebi-gene-expression-group / atlas-web-single-cell

Single Cell Expression Atlas web application
Apache License 2.0
5 stars 5 forks source link

Metadata search initially use 'Any' for species in the request parameter #438

Closed ke4 closed 1 month ago

ke4 commented 1 month ago

In the Single Cell Expression Atlas the gene search on the homepage initially using Any as a value for the request parameter for species. In case of the species dropdown set to Any, the request parameter should contains all the species's value and not a single Any value.

Workaround to fix the search:

  1. Select any other value from the Species dropdown.
  2. Select Any value from the Species dropdown.
ke4 commented 1 month ago

The logic that transform the Any label when its value is ` is here: In thescxa-gene-search-formin theAutocomplete.js`

function _asyncFetchOptions (host, suggesterEndpoint, selectedSpecies, allSpecies) {
  return async (inputValue) => {
    const suggesterUrl = URI(suggesterEndpoint, host).search({
      query: inputValue,
      species: selectedSpecies || allSpecies.join(`,`)
    }).toString()

    const response = await fetch(suggesterUrl)
    if (response.ok) {
      return await response.json()
    }
    throw new Error(`${suggesterUrl} => ${response.status}`)
  }
}

the line:

species: selectedSpecies || allSpecies.join(`,`)

is responsible for it, but for returning all species selectedSpecies should be undefined or empty. In the initial state of the search component the species's value is not empty, but Any. So, we probably need to change it to empty in the that component.

ke4 commented 1 month ago

I think we probably have to change the initial value of the Species dropdown in the search.jsp where we define initial values for the search form. I am going to test my theory locally.

ke4 commented 1 month ago

Yes. My test worked. It was enough to change the value from Any to ` in thesearch.jsp`.

From:

defaultSpecies: `Any`,

To:

defaultSpecies: ``,
ke4 commented 1 month ago

Tested on test and staging env.