broadinstitute / single_cell_portal_core

Rails/Docker application for the Broad Institute's single cell RNA-seq data portal
https://singlecell.broadinstitute.org
BSD 3-Clause "New" or "Revised" License
62 stars 26 forks source link

Fix setting tab parameter for analytics (SCP-5634) #2106

Closed bistline closed 2 months ago

bistline commented 2 months ago

BACKGROUND & CHANGES

This fixes a bug with setting the tab property on client-side Mixpanel events. The issue was an improperly scoped regular expression that relied on the tab search parameter to be in the first position (i.e. directly after the ? character). Now, the native URLSearchParams class is used to parse the entire search string and determine if the tab parameter has been specified. If not, it will default to the value of window.location.hash, if present.

MANUAL TESTING

  1. Boot as normal and load any study that has clustering & expression data
  2. Open the Chrome Dev Tools > Network tab
  3. Query for a gene and then click into the Distribution tab and wait for the plot to load
  4. In the network tab, find the entry for plot:violin and confirm that you see the tab parameter is correctly set: Screenshot 2024-08-13 at 2 21 58 PM

(Note: if the violin plot renders before you click into the Distribution tab, this may be set to scatter or #study-visualize, depending on your URL state).

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.80%. Comparing base (b956149) to head (0957943). Report is 15 commits behind head on development.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2106/graphs/tree.svg?width=650&height=150&src=pr&token=HMWE5BO2a4&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute)](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2106?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute) ```diff @@ Coverage Diff @@ ## development #2106 +/- ## =============================================== + Coverage 69.62% 69.80% +0.17% =============================================== Files 324 324 Lines 27265 27275 +10 Branches 2251 2251 =============================================== + Hits 18982 19038 +56 + Misses 8158 8112 -46 Partials 125 125 ``` | [Files](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2106?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute) | Coverage Δ | | |---|---|---| | [app/javascript/lib/metrics-api.js](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2106?src=pr&el=tree&filepath=app%2Fjavascript%2Flib%2Fmetrics-api.js&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute#diff-YXBwL2phdmFzY3JpcHQvbGliL21ldHJpY3MtYXBpLmpz) | `54.20% <100.00%> (+0.81%)` | :arrow_up: | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2106/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute)