2e609c69e2e33c01daa54b21ee4e2a71ddf6d639
chmalee
  Tue Jan 23 10:24:53 2024 -0800
Don't add an empty hubUrl to track search hgTracks form  unless there really was a hub result that was clicked on, refs #32909

diff --git src/hg/js/utils.js src/hg/js/utils.js
index 8ea7efd..a0df8f9 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -3018,31 +3018,31 @@
 
             if (needSel) {
                 if (checked)
                     $(hiddenSel).val('1');
                 else
                     $(hiddenSel).val('0');  // Can't set it to [] because it means default is used.
                 $(hiddenSel).attr('disabled',false);
             }
         }
 
         // if we selected a track in a public hub that is unconnected, we need to get the
         // hubUrl into the form so the genome browser knows to load that hub. If the hub
         // was already a connected hub, then we don't need to specify anything because it
         // will already be in the cart and we handle the visibility settings like normal.
         // The hubUrl field present in the json indicates this is an unconnected hub
-        if (justClicked && hubUrl !== undefined) {
+        if (justClicked && hubUrl !== undefined && hubUrl.length > 0) {
             var form = $("form[id='searchResults'");
             var newHubInput = document.createElement("input");
             // if we are a subtrack we need to explicitly hide the parent
             // track so ALL subtracks of the parent don't show up unexpectedly
             if (needSel) {
                 var parentTrack = tdb.parentTrack;
                 var parentTrackInput = document.createElement("input");
                 parentTrackInput.setAttribute("type", "hidden");
                 parentTrackInput.setAttribute("name", parentTrack);
                 parentTrackInput.setAttribute("value", "hide");
                 form.append(parentTrackInput);
             }
             newHubInput.setAttribute("type", "hidden");
             newHubInput.setAttribute("name", "hubUrl");
             newHubInput.setAttribute("value", hubUrl);