Skip to content

Commit

Permalink
Bug fix -- genome list divider was searched by class, rather than ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Feb 7, 2024
1 parent c78734e commit e183bfe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/genomeWidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from '../node_modules/igv-widgets/dist/igv-widgets.js'
import Globals from "./globals.js"

const MAX_CUSTOM_GENOMES = 5
const MAX_CUSTOM_GENOMES = 10

let predefinedGenomeIds
let predefinedGenomes
Expand Down Expand Up @@ -121,8 +121,12 @@ function getCustomGenomes() {
function updateGenomeList() {

const $dropdown_menu = $('#igv-app-genome-dropdown-menu')
// discard all buttons preceeding the divider div
let $divider = $dropdown_menu.find('.dropdown-divider')

// NOTE: MUST USE ID HERE, THERE CAN BE MULTIPLE DIVIDERS. JQUERY DOES WEIRD THINGS IN THE CODE THAT FOLLOWS IF $divider IS A COLLECTION
const $divider = $dropdown_menu.find('#igv-app-genome-dropdown-divider')

// discard all buttons following the divider div
$divider.nextAll().off()
$divider.nextAll().remove()

const addEntryFor = (genomeJson) => {
Expand Down Expand Up @@ -155,7 +159,7 @@ function updateGenomeList() {
const customGenomes = getCustomGenomes()
if (customGenomes && customGenomes.length > 0) {
$('<div class="dropdown-divider"></div>').insertAfter($divider)
for (let genomeJson of customGenomes) {
for (let genomeJson of customGenomes.reverse()) {
addEntryFor(genomeJson)
}

Expand Down

0 comments on commit e183bfe

Please sign in to comment.