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

Issue #900: Load legend state from URL #923

Conversation

ncallaway
Copy link

@ncallaway ncallaway commented Mar 5, 2020

This should resolve issue #900 by loading the legend state from the URL.

Notes

  • This adds a new state parameter to the redux-control legendOpen, which behaves similarly to sidebarOpen
  • This preserves existing behavior where the legend changes its default behavior based on the size of the browser window, or the number of items in the legend.
    ** If the default due to the browser window size would be closed, but the URL parameter is open, then the URL parameter wins.
  • This adds one additional error to the lint output (we go from 161 problems, 143 errors up to 162 problems, 144 errors). Because of the number of eslint errors, I haven't been able to find the one issue that I introduced. However, the newly introduced lint failure is autofixable with the --fix option. Because there are 96 errors that will be fixed with the --fix option, I want to leave that out of this PR. However, I can make a follow-up PR that runs lint with the --fix option.

PR Questions

  • Should we also persist changes to the legend state back to the URL (the same way the c parameter gets set and updated in the URL)?
  • Is there anywhere that URL parameters that would be useful for embedding or external consumers are documented? Where can I add documentation about this feature?

@ncallaway ncallaway changed the title Issue #77: Load legend state from URL Issue #900: Load legend state from URL Mar 5, 2020
@jameshadfield jameshadfield merged commit 6be48cb into nextstrain:master Mar 9, 2020
@jameshadfield
Copy link
Member

Thanks @ncallaway - this is excellent! I've merged this with two additional commits (both of which you mentioned in your comment!)

  1. d9628c6 removes the URL query upon user interaction, so that the query + app state don't diverge. In the future we may explore changing the URL query upon all user interactions, but for now this is great.

  2. 014b839 adds documentation to https://nextstrain.github.io/auspice/advanced-functionality/view-settings (or, it will, once I rebuild the docs!)

Re: Linting errors. These are a long-term endeavor to improve. I get them flagged up in VS code and have been slowly fixing them as time allows. PRs would be great!

Thanks again 🙏

@ncallaway
Copy link
Author

ncallaway commented Mar 9, 2020

@jameshadfield That looks great. If I make any other changes to URL state I'll make sure to update the documentation.

I've made the PR that runs the autolinting here: #931.

After running it, I did find the linting error that this introduced and saw that its fixed in that PR.

@tsibley
Copy link
Member

tsibley commented Mar 9, 2020

@ncallaway A little late in this instance, perhaps, but for whatever it's worth, I wrote a small tool to help me find eslint errors I introduce into projects which aren't eslint-clean yet: https://github.com/tsibley/git-eslint. Not great, but gets the job done. :-)

@ncallaway ncallaway deleted the issues/issue-77-load-legend-state-from-url branch March 10, 2020 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants