kanaverse / kana

Single cell analysis in the browser
https://kanaverse.org/kana/
MIT License
142 stars 12 forks source link

explore mode fails when switching between modalities #249

Open LTLA opened 1 year ago

LTLA commented 1 year ago

If you have a multi-modal analysis

AND you switch between modalities in the UI

AND the row data is different between the modalities,

we see the following bug:

Screenshot 2023-09-22 at 11 20 50 AM

I've traced this to

https://github.com/kanaverse/kana/blob/e6764a7a607f3e2c4b226cd1d59631f77ef22261/src/components/Markers/index.js#L1154-L1156

where it seems that geneColSel[props?.selectedModality] refers to a column of genesInfo that does not yet exist because genesInfo is still pointing to the previous modality's row data while geneColSel[props?.selectedModality] is new.

I think this is because geneColSel remembers its previous selection (which is good), so when you go to a new modality and then go back to the previous modality, it tries to retrieve the previous selection (so far so good) but the genesInfo has not yet updated. I guess there must be some code that defends against this on the first selection of a new modality, but this is skipped when we re-select a modality that we went to before?