lanl / 4DGB

4D Genome Browser project
1 stars 2 forks source link

Refactor Selection Management #75

Closed camtauxe closed 2 years ago

camtauxe commented 2 years ago

The way selections of the Genome are handled has been refactored. There is now a Selection class: An immutable type that represents one or more selected regions. It can be created from either of three units we use (locations, segments or genes) and can provide its value in any of those units. A new Controller class emits events to track changes in a selection. Different components can listen to events from the same Controller to keep their selections in sync.

I hope that the many deletions in files like compare.js can serve as evidence of how much the code can be cleaned up by doing things this way. With this model, creating new components that "just work" alongside the others will be easier.

dhrogers commented 2 years ago

After this merge, we are failing the selection test (https://github.com/lanl/4DGB/actions/runs/1271286371):

FAIL testing/selection.test.js

Test suite failed to run

Cannot find module '../client-js/GTK/Selection.js' from 'testing/selection.test.js'

  1 | const Client    = require('../client-js/GTK/Client.js');
> 2 | const Selection = require('../client-js/GTK/Selection.js');
    |                   ^
  3 |
  4 | var TestTypes = ["location", "segment", "gene"]
  5 | TestTypes = ["location", "segment"]

  at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:311:11)
  at Object.<anonymous> (testing/selection.test.js:2:19)