From deda89c92d5f14f61834a997f48690413ebd43a1 Mon Sep 17 00:00:00 2001 From: jrobinso <933148+jrobinso@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:03:13 -0800 Subject: [PATCH] bug fix -- genome list reversed every other invocation --- js/genomeWidgets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/genomeWidgets.js b/js/genomeWidgets.js index 8c11d65..07dba52 100644 --- a/js/genomeWidgets.js +++ b/js/genomeWidgets.js @@ -80,7 +80,7 @@ function createGenomeWidgets({$igvMain, urlModalId, genomeFileLoad}) { */ async function initializeGenomeWidgets(genomes) { try { - predefinedGenomes = await getAppLaunchGenomes(genomes)// Default genome list + predefinedGenomes = (await getAppLaunchGenomes(genomes)).reverse() // Default genome list predefinedGenomeIds = new Set(predefinedGenomes.map(g => g.id)) updateGenomeList() @@ -114,7 +114,7 @@ async function getAppLaunchGenomes(genomes) { function getCustomGenomes() { const customGenomeString = localStorage.getItem("customGenomes") - return customGenomeString ? JSON.parse(customGenomeString) : [] + return customGenomeString ? JSON.parse(customGenomeString).reverse() : [] } @@ -151,7 +151,7 @@ function updateGenomeList() { // TODO -- why do we need to add everthing in reverse? if (predefinedGenomes && predefinedGenomes.length > 0) { - for (let genomeJson of predefinedGenomes.reverse()) { + for (let genomeJson of predefinedGenomes) { addEntryFor(genomeJson) } } @@ -159,7 +159,7 @@ function updateGenomeList() { const customGenomes = getCustomGenomes() if (customGenomes && customGenomes.length > 0) { $('').insertAfter($divider) - for (let genomeJson of customGenomes.reverse()) { + for (let genomeJson of customGenomes) { addEntryFor(genomeJson) }