Skip to content

Commit

Permalink
Remove legend URL query upon user interaction
Browse files Browse the repository at this point in the history
This mirrors what we do for sidebar open state and prevents the URL query and the app state being out-of-sync
  • Loading branch information
jameshadfield committed Mar 9, 2020
1 parent 6be48cb commit d9628c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/tree/legend/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Legend extends React.Component {
}

showLegend() {
// redux state takes precedent
if (this.props.legendOpen !== undefined) { return this.props.legendOpen; }

// Our default state changes based on the size of the window or the number of items in the legend.
Expand Down
7 changes: 7 additions & 0 deletions src/middleware/changeURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export const changeURLMiddleware = (store) => (next) => (action) => {
}
break;
}
case types.TOGGLE_LEGEND: {
// we treat this the same as sidebar above -- it can only be added to the URL manually
if ("legend" in query) {
query.legend = undefined;
}
break;
}
case types.TOGGLE_PANEL_DISPLAY: {
if (state.controls.panelsAvailable.length === action.panelsToDisplay.length) {
query.d = undefined;
Expand Down

0 comments on commit d9628c6

Please sign in to comment.