Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page history broken during navigation #815

Closed
tsibley opened this issue Sep 16, 2019 · 1 comment · Fixed by #841
Closed

Page history broken during navigation #815

tsibley opened this issue Sep 16, 2019 · 1 comment · Fixed by #841
Labels
bug Something isn't working please take this issue

Comments

@tsibley
Copy link
Member

tsibley commented Sep 16, 2019

There's some weird behaviour with Auspice modifying page history such that the back button breaks. For example, go to https://nextstrain.org/staging, observe you get a list of staging datasets and no 404 message, click a dataset, click the back button. You end up with a 404 message and a list of "live" datasets, instead of where you were (but the URL is intact). This manifests with other pages as well. I suspect this is because Auspice is being too greedy about what it considers a dataset for display.

Discussion about this started here: https://bedfordlab.slack.com/archives/C116R9PR7/p1568322725029100

@joverlee521
Copy link
Contributor

joverlee521 commented Jan 3, 2020

I won't have time this week to work on this issue, but I did do some digging and wanted to document here for future reference (for myself or anyone else who wants to work on this):

  1. An event listener monitors for popstate event in /src/components/framework/monitor.js
  2. A popstate event would trigger the changePage action in /src/actions/navigation.js
  3. If the path has changed, then dispatch with:
    • action.type : PAGE_CHANGE
    • action.displayComponent : "datasetLoader"
  4. This goes to the general reducer in src/reducers/general.js to create a new state for displayComponent
  5. Changes to the displayComponent state leads to re-render of MainComponentSwitch in /src/root.js and returns the DatasetLoader in /src/components/datasetLoader/index.js
  6. The DatasetLoader triggers the loadJSONs action in /src/actions/loadData.js, which calls fetchDataAndDispatch
  7. fetchDataAndDispatch calls getDataset(mainDatasetUrl) which is where the app actually reaches an error:
Trace: Error:  not in available datasets
    at Object.extendDataPathsToMatchAvailable (/Users/jlee2346/Repos/nextstrain/auspice/cli/server/getDatasetHelpers.js:59:11)
    at /Users/jlee2346/Repos/nextstrain/auspice/cli/server/getDataset.js:9:15
    at Console.trace (internal/console/constructor.js:336:11)
    at /Users/jlee2346/Repos/nextstrain/auspice/cli/server/getDataset.js:13:15
[warning]       couldn't fetch JSONs --  not in available datasets

After writing all that out, I'm also not entirely sure in which step should changes be made to ensure that auspice is not being "too greedy"

I guess github is my rubber duck today. See PR #841.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working please take this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants