nextstrain / nextstrain.org

The Nextstrain website
https://nextstrain.org
GNU Affero General Public License v3.0
90 stars 48 forks source link

Error when navigating between datasets using dropdown menu on community build #240

Open kistlerk opened 3 years ago

kistlerk commented 3 years ago

Current Behavior
Unable to navigate between viruses on Nextstrain Community using the dropdown menu

Expected behavior
Should be able to select a different virus from the drop-down menu to load the tree for that virus. Navigating between genes works as expected.

How to reproduce
Steps to reproduce the current behavior:

  1. go to https://nextstrain.org/community/blab/seasonal-cov-adaptive-evolution/229e/rdrp
  2. use drop down menu to select "oc43" instead of "229e"
  3. Error is: "There seems to have been an error accessing that dataset. Details: Couldn't load JSONs for /community/blab/seasonal-cov-adaptive-evolution/oc43. Please email us if you think this is a bug."

Your environment: if browsing Nextstrain online

jameshadfield commented 3 years ago

Thanks Katie 👍

Notes for bugfix: this happens because when using the sidebar to change dataset, auspice forms the desired dataset using fields up-to the level of the changed dropdown box. In this case, the client makes a request for the /community/blab/sesonal-cov-adaptive-evolution/oc43 dataset, which doesn't exist and so we get the 404. The reason this doesn't happen elsewhere, e.g. in the core builds, is that the server will respond with a 304 redirect to point to the "best" dataset given the (non-existing) requested dataset. E.g. a request for /flu gets redirected to /flu/seasonal/h3n2/ha/2y. To fix this bug the server logic should be changed in this case to return a redirect from /community/blab/sesonal-cov-adaptive-evolution/oc43 to /community/blab/sesonal-cov-adaptive-evolution/oc43/<X> where <X> is {rdrp,s1,s2,spike}; how exactly <X> is to be chosen here is up for grabs. Note that the request does not contain information about the previous dataset viewed (/229e/rdrp in this example); to do so would require a change in the request sent from auspice.

jameshadfield commented 2 weeks ago

Another report of this bug at https://discussion.nextstrain.org/t/load-json-fails-when-change-dataset-on-nextstrain/1778

In the situation where we have /a/b1/c and we change b1 to b2 then, assuming /a/b2 doesn't exist the "correct" thing to do is obvious: load /a/b2/c. If c doesn't exist then it's less clear.

genehack commented 2 weeks ago

Another report of this bug at https://discussion.nextstrain.org/t/load-json-fails-when-change-dataset-on-nextstrain/1778

In the situation where we have /a/b1/c and we change b1 to b2 then, assuming /a/b2 doesn't exist the "correct" thing to do is obvious: load /a/b2/c. If c doesn't exist then it's less clear.

I mean, if you directly load /a/b2, what happens? Seems like if it loads something that would be the correct fallback if /a/b2/c doesn't exist?

jameshadfield commented 2 weeks ago

I mean, if you directly load /a/b2, what happens?

If you directly load it you get the same behaviour as you do when changing the dropdown from b1 to b2 which is a 404 page.

genehack commented 2 weeks ago

I mean, if you directly load /a/b2, what happens?

If you directly load it you get the same behaviour as you do when changing the dropdown from b1 to b2 which is a 404 page.

nod so is the fix maybe "allow a specified default sub-set fallback"? Or is it "resolve the tree of dropdown combinations and don't allow invalid ones to be selected"?