4ab22d829bff96467e64331dad271bcb0bc84de1
chmalee
  Tue Mar 24 15:22:00 2026 -0700
Force genark autocomplete results to send their genome identifier like GC[AF]_XXX as the db field to hgGateway back end, refs #37276

diff --git src/hg/js/autocompleteCat.js src/hg/js/autocompleteCat.js
index bcee769fa43..0f0e7ce13d5 100644
--- src/hg/js/autocompleteCat.js
+++ src/hg/js/autocompleteCat.js
@@ -211,30 +211,35 @@
                     ui.item.value = ui.item.value.replace(/<[^>]*>/g, '');
                 }
                 // since we are in an autocomplete don't bother saving the
                 // prefix the user typed in, just keep the geneSymbol itself
                 if (this.id === "positionInput") {
                     let key = typeof(ui.item.geneSymbol) !== 'undefined' ? ui.item.geneSymbol : ui.item.value;
                     addRecentSearch(getDb(), key, ui.item);
                 }
                 // Save genome selection for species search bars, but only if item has a definite db.
                 // Taxa-only selections (like "Human" without a specific db) are handled by the
                 // CGI's response handler after the actual db is determined.
                 if (options.showRecentGenomes && ui.item.db && !ui.item.disabled) {
                     if (ui.item.originalCategory) {
                         ui.item.category = ui.item.originalCategory;
                     }
+                    // For GenArk results, normalize db to the accession (item.genome)
+                    // so localStorage keys match what the CGI response handler expects
+                    if (isGenarkItem(ui.item)) {
+                        ui.item.db = ui.item.genome;
+                    }
                     addRecentGenome(ui.item);
                 }
                 if (typeof opts.onSelect === 'function') {
                     opts.onSelect(ui.item, $el);
                 }
                 $el.blur();
             };
 
             // Provide default values where necessary:
             opts.onSelect = opts.onSelect || function(){};
             opts.enterSelectsIdentical = opts.enterSelectsIdentical || false;
 
             $el.autocompleteCat({
                 delay: 500,
                 minLength: 0,