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 second tree loading & parsing #1788

Merged
merged 5 commits into from
Jun 17, 2024

Commits on Jun 17, 2024

  1. Unify common code for loading a second tree

    There are two ways of loading a second tree: upon initial load /
    narrative slide progression (logic within `createStateFromQueryOrJSONs`)
    or via the sidebar "second tree" UI (logic within `createTreeTooState`).
    This commit aims to reduce the duplication of code between these functions,
    where possible given the current design.
    
    There is one behavioural change - the second method of loading a tree
    now no longer skips the `castIncorrectTypes` error correction function.
    
    Tangentially: the code in this file is fragile and the order of function
    calls is crucial. I hope the adoption of TS will improve resilience
    here.
    jameshadfield committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    bc47201 View commit details
    Browse the repository at this point in the history
  2. Allow filtering of data in second tree

    Trees define traitNames and traitValues via their `node_attrs` in the
    dataset JSON, for instance "traitName=country" and "traitValue=New
    Zealand". We populate the filtering dropdowns using these, but had
    previously only considered the main (LHS) tree. Behavioural changes:
    
    * traitName & traitValue present on both trees: no change. Filtering
      works as expected.
    * traitName on both trees, traitValue only on 2nd tree: functionality
      added here.
    * traitName only present on 2nd tree: this now works, but the app
      crashes from an uncaught error in the filter badges shown in the
      header. This will be fixed in the next commit.
    
    In addition, mutations and node ("sample") names unique to the 2nd tree
    are added to the available filters.
    
    Closes #1781
    jameshadfield committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    6094ba2 View commit details
    Browse the repository at this point in the history
  3. Update filter badges for multiple trees

    The previous implementation only reflected counts in the LHS tree,
    irregardless of any occurrences which may or may not be present in the
    RHS tree. We now communicate both. This also fixes a bug introduced in
    the previous commit where filtering to a traitName not present in the
    LHS tree would cause an uncaught exception.
    jameshadfield committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    5d29e97 View commit details
    Browse the repository at this point in the history
  4. Allow branch labels from second tree

    Branch labels were already rendered correctly on the RHS tree if the key
    was present in the LHS tree, so all that's required is to add label keys
    which are only observed in the RHS tree to appear in the sidebar branch
    label selector.
    
    Closes #1780
    jameshadfield committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    7685fb2 View commit details
    Browse the repository at this point in the history
  5. changelog

    jameshadfield committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    99e5336 View commit details
    Browse the repository at this point in the history