3d572367254cbf4644b0e8793ac7bdf42bb192c5
max
  Fri Jan 10 02:16:48 2025 -0800
fixing case that Gerardo found: user hides a few tracks without reloading the page in between these clicks, refs #34959

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index c9b728f..f07702b 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2177,38 +2177,40 @@
                 // The problem is that it's not easy to find out if there is an easier way to hide them, the code
                 // would have to go over all possible parents, not just topParents. Maybe one day.
                 //if (tdbIsSubtrack(rec)) {
                  //  cartVars.push(childName+"_sel");
                  //   cartVals.push('0');
                 //}
             }
 
             // and set the lone parent to hide in the cart
             cartVars.push(loneParent);
             cartVals.push('hide');  // need to explicitely set to "hide", not "[]", to hide the default tracks
              
             // update the track list below the image
             vis.update(loneParent, 'hide');
             rightClick.hideLegends();
+            delete hgTracks.trackDb[loneParent]; // for the next right-click
         }
 
         // handle all other tracks, they are either not parents or parents with at least one child left
         var delIds = familyAnalysis.others;
         for (var i = 0; i<delIds.length; i++) {
             var id = delIds[i];
             cartHideAnyTrack(id, cartVars, cartVals);
             $(document.getElementById('tr_' + id)).remove();
+            delete hgTracks.trackDb[id]; // for the next right-click
         }
         imageV2.afterImgChange(true);
         cart.setVars( cartVars, cartVals );
     },
 
     hideOthers: function (id) {
         /* hide all tracks but 'id'. Hide parents of composites/folders, rather than their children */
         var myParent = hgTracks.trackDb[id].parentTrack;
 
         var hideList = [];
         for (var otherId in hgTracks.trackDb) {
             if (otherId===id || otherId==="ruler")
                 continue;
 
             hideList.push(otherId);