From 353b1e6a4a199f44a031d233592420d062922da4 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:24:55 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20add=20URL=20query?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/recomputeReduxState.js | 5 +++++ src/middleware/changeURL.js | 10 ++++++++++ 2 files changed, 15 insertions(+) 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