0a79208523fe1f7091bf6c9ef0302ea57df9f5dc
braney
  Thu Feb 26 06:56:42 2026 -0800
cache lastChromId properly  refs #37138

diff --git src/hg/hgc/clinvarSubLolly.c src/hg/hgc/clinvarSubLolly.c
index af0892ce0d2..aa5866c400b 100644
--- src/hg/hgc/clinvarSubLolly.c
+++ src/hg/hgc/clinvarSubLolly.c
@@ -83,57 +83,60 @@
 char *chrom = cartString(cart, "c");
 char *fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table);
 struct bbiFile *bbi =  bigBedFileOpenAlias(hReplaceGbdb(fileName), chromAliasFindAliases);
 struct lm *lm = lmInit(0);
 struct bigBedInterval *bb, *bbList; 
 char *quickLiftFile = cloneString(trackDbSetting(tdb, "quickLiftUrl"));
 struct hash *chainHash = NULL;
 if (quickLiftFile)
     bbList = quickLiftGetIntervals(quickLiftFile, bbi, chrom, start, end, &chainHash);
 else
     bbList = bigBedIntervalQuery(bbi, chrom, start, end, 0, lm);
 
 char *fields[bbi->fieldCount];
 for (bb = bbList; bb != NULL; bb = bb->next)
     {
+    int lastId = -1;
     struct bed *bed = NULL;;
     char startBuf[16], endBuf[16];
     struct bed tempBed;
     bigBedIntervalToRow(bb, chrom, startBuf, endBuf, fields, bbi->fieldCount);
     if (quickLiftFile)
         bed = quickLiftIntervalsToBed(bbi, chainHash, bb);
     else
         {
         tempBed.chrom = chrom;
         tempBed.chromStart = bb->start;
         tempBed.chromEnd = bb->end;
         tempBed.name = fields[3];
         bed = &tempBed;
         }
 
     if (!(bed->chromStart == start && bed->chromEnd == end))
 	continue;
 
     // our names are unique
     char *name = bed->name;
     boolean match = (isEmpty(name) && isEmpty(item)) || sameOk(name, item);
     if (!match)
         continue;
 
     int numSubs = chopString(fields[12], ",", NULL, 0);
 
     printPos(bed->chrom, bed->chromStart, bed->chromEnd, NULL, FALSE, name);
     
     char chromBuf[2048];
-    bbiCachedChromLookup(bbi, bb->chromId, -1, chromBuf, sizeof chromBuf);
+    bbiCachedChromLookup(bbi, bb->chromId, lastId, chromBuf, sizeof chromBuf);
+    lastId = bb->chromId;
+
     // print all the submissions that match the clinical significance of the
     // bead that the user clicked on.
     printSubmissions(tdb,  chromBuf, bb->start, bb->end, atoi(fields[4]), numSubs, FALSE);
 
     // now print the ones with a different clinical status
     printSubmissions(tdb,  chromBuf, bb->start, bb->end, atoi(fields[4]), numSubs, TRUE);
 
     // we found what we wanted
     break;
     }
 printTrackHtml(tdb);
 }