diff --git a/src/actions/recomputeReduxState.js b/src/actions/recomputeReduxState.js index 588e5dc62..a4c059e11 100644 --- a/src/actions/recomputeReduxState.js +++ b/src/actions/recomputeReduxState.js @@ -64,6 +64,11 @@ const modifyStateViaURLQuery = (state, query) => { if (query.m && state.branchLengthsToDisplay === "divAndDate") { state["distanceMeasure"] = query.m; } + if (query.focus === undefined) { + state["treeFocus"] = false; + } else { + state["treeFocus"] = true; + } if (query.c) { state["colorBy"] = query.c; } diff --git a/src/middleware/changeURL.js b/src/middleware/changeURL.js index a57511c7f..15c0179e7 100644 --- a/src/middleware/changeURL.js +++ b/src/middleware/changeURL.js @@ -140,6 +140,16 @@ export const changeURLMiddleware = (store) => (next) => (action) => { query.p = action.notInURLState === true ? undefined : action.data; break; } + case types.TOGGLE_TREE_FOCUS: { + // "null" is truthy - see query.ci implementation + if ("focus" in action) { + query.focus = action.focus ? null : undefined + } + else { + query.focus = ("focus" in query) ? undefined : null; + } + break; + } case types.TOGGLE_SIDEBAR: { // we never add this to the URL on purpose -- it should be manually set as it specifies a world // where resizes can not open / close the sidebar. The exception is if it's toggled, we