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

Improve interaction between selected node modal and strain filters #1749

Merged
merged 5 commits into from
Feb 8, 2024

Conversation

jameshadfield
Copy link
Member

I think the first four commits are reasonably straight forward in terms of code + UI, but the final commit represents my best attempt to fix the situation described in #1701 while still maintaining the expected behaviour when we click on tips without having any strain-filters enabled.

Closes #1701
Closes #1243

@nextstrain-bot nextstrain-bot temporarily deployed to auspice-james-selected--faurlc February 5, 2024 03:52 Inactive
Lifting this from tree state to redux state paves the way to fix
inconsistent behaviour as well as allowing the information to be
displayed in a modal outside of the Tree component in the future.

We no longer update the (tip circle) radius within `clearSelectedNode`
as testing (Firefox v121, Chrome v121) shows the `onTipLeave` function
is enough to achieve the desired radius update.
With the previous commit creating "selectedNode" as part of redux state,
the tree state variable "selectedNode" is only used for hover events, so
rename it to convey this.
Clicking a tip brings up a modal and activates the corresponding strain
filter. Inactivating or removing this filter now also clears the modal.

Closes #1243
Clicking on a tip activates a modal and activates the corresponding
strain filter. Previously clearing the modal would always inactivate the
filter. In the absence of any filtering this behaviour is not bad, but
when already filtering to a set of strains then it's counter-intuitive
because we inactivate a filter that was active.

The new behaviour restores the filtering state of the strain before the
modal was opened. Specifically,
* If the tip was already filtered, opening and closing the modal doesn't
  change the filters.
* If the tip was filtered but inactive, opening the modal activates it
  and closing the modal returns it to the inactive state.
* If the tip wasn't filtered (active or inactive) then opening the modal
  makes it an active filter and closing the modal removes the filter
  entirely.

Closes #1701
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-james-selected--faurlc February 6, 2024 01:04 Inactive
@jameshadfield
Copy link
Member Author

Merging after discussion with @trvrb

@jameshadfield jameshadfield merged commit c55e902 into master Feb 8, 2024
20 checks passed
@jameshadfield jameshadfield deleted the james/selected-strain branch February 8, 2024 23:36
jameshadfield added a commit that referenced this pull request Feb 20, 2024
With the changes in the previous commit we no longer need the
`isTerminal` argument, as we use the (more accurate) `isBranch`
property. This removes the console errors "trying to remove values from
an un-initialised filter!" when shift-clicking on a branch then removing
the info modal. The bug was introduced by #1749.
jameshadfield added a commit that referenced this pull request Jun 6, 2024
This bug arrived with recent work which lifted the selected node state
out of component state and into redux¹, where I forgot to consider
tangletrees so that we always ended up retrieving the node (via array
index) from the LHS tree.

Closes <#1770>

¹ <#1749>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants