b0f8840863d5673f41d45932502249141a9e3241 braney Mon Aug 31 10:00:49 2026 -0700 cart.c: keep the session position when db= resolves to the same assembly, refs #38184 resolveGenarkDb takes db out of the cart, so the block that runs after hubConnectLoadHubs saw an empty db and called every GenArk db= a database change. It then set the old db to "none", which getDbAndGenome reads as a switch of assembly: the position was replaced with the assembly default and virtMode, virtModeType and nonVirtPosition were dropped. A session loaded with db=GCF_... came up at the default position instead of the one it saved. Only call it a database change when the value the cart had before the CGI variables were applied names a different database. A session that really is on another assembly still gets the default position. diff --git src/hg/lib/cart.c src/hg/lib/cart.c index cc42d06d0e2..cdd5681aaae 100644 --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@ -1958,35 +1958,42 @@ if (didSessionLoad) { cartCopyLocalHubs(cart); // Loading a session empties the cart and then puts the CGI variables back, which // undoes the work fixUpDb did above. A Genark accession in db= has to be turned // back into a genome and a hubUrl before we connect the hubs. refs #38184 resolveGenarkDb(cart); } char *newDatabase = hubConnectLoadHubs(cart); if (newDatabase != NULL) { char *cartDb = cartOptionalString(cart, "db"); + char *oldDb = (oldVars != NULL) ? hashFindVal(oldVars, "db") : NULL; if ((cartDb == NULL) || differentString(cartDb, newDatabase)) { + // resolveGenarkDb takes db out of the cart, so a Genark db= that names the assembly + // the cart was already on looks like a database change here. It is not one, and the + // magic below would replace the position we just loaded from a session with the + // assembly default and drop the multi-region variables. refs #38184 + boolean sameDb = !IS_CART_VAR_EMPTY(oldDb) && sameString(oldDb, newDatabase); + // this is some magic to use the defaultPosition and reset cart variables - if (oldVars) + if (oldVars && !sameDb) { struct hashEl *hel; if ((hel = hashLookup(oldVars,"db")) != NULL) hel->val = "none"; else hashAdd(oldVars, "db", "none"); } cartSetString(cart,"db", newDatabase); } } if (exclude != NULL) { while ((ex = *exclude++)) cartExclude(cart, ex);