3bcf86a0995e5a15ad5a2a8ff5533f48d5d43653
max
  Fri Sep 18 07:15:28 2026 -0700
hgTracks: tell the user what a session load just did, refs #38157

#Preview2 week - bugs introduced now will need a build patch to fix
When a saved session is loaded it replaces the whole cart, and the view the
user had before is gone without a word.  hgTracks now shows a note on that
page saying which session was opened, who saved it and when, the session
description if it has one, and that the previous configuration cannot be
brought back.  Only on that one page: cart.c leaves a marker when a full
(non-merge) session load happens and hgTracks takes it out again.
Recommended track sets merge into the cart, so they get no note.

The note uses a new notifBoxOnce() in utils.js, which has only a Close
button: a one-page message does not need 'Don't show again'.  Its .notifBoxOnce
style is the card grey of the new Sessions page, and it sets no width, so
unlike the other notifBoxes it cannot stick out of the window.

Switch off with sessionLoadNotice=off in hg.conf.

diff --git src/hg/js/utils.js src/hg/js/utils.js
index dad1b8f33cf..f775206a862 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -1037,30 +1037,51 @@
         "</div>";
     if (!alreadyPresent) {
         document.body.appendChild(notifBox);
     }
     $("#"+lsKey+"notifyHide").click({"id":lsKey}, function() {
         let key = arguments[0].data.id;
         $("#"+key+"notifBox").remove();
     });
     $("#"+lsKey+"notifyHideForever").click({"id": lsKey}, function() {
         let key = arguments[0].data.id;
         $("#"+key+"notifBox").remove();
         localStorage.setItem(key, "1");
     });
 }
 
+function notifBoxOnce(msg, id) {
+/* Show a notification that is meant for this page only, e.g. to say what just happened.
+ * Unlike notifBoxSetup() it does not use localStorage, so it has no "Don't show again"
+ * button: the message is gone on the next page anyway. */
+    let boxId = id + "notifBoxOnce";
+    if (document.getElementById(boxId))
+        return;
+    let box = document.createElement("div");
+    box.className = "notifBox notifBoxOnce";
+    box.id = boxId;
+    box.innerHTML = msg +
+        "<div style='text-align: center'><button id='" + id + "notifyOnceHide'>Close</button></div>";
+    let parentEl = document.getElementById('TrackHeaderForm');
+    if (!parentEl)
+        parentEl = document.body;
+    parentEl.appendChild(box);
+    $("#" + id + "notifyOnceHide").click(function() {
+        $("#" + boxId).remove();
+    });
+}
+
 function warnBoxJsSetup()
 {   // Sets up warnBox if not already established.  This is duplicated from htmshell.c
     var html = "";
     html += "<center>";
     html += "<div id='warnBox' style='display:none;'>";
     html += "<CENTER><B id='warnHead'></B></CENTER>";
     html += "<UL id='warnList'></UL>";
     html += "<CENTER><button id='warnOK'></button></CENTER>";
     html += "</div></center>";
 
 
     // GALT TODO either add nonce or move the showWarnBox and hideWarnBox to some universal javascript 
     //   file that is always included. Or consider if we can just dynamically define the functions
     //   right here inside this function?  maybe prepend function names with "window." to (re)define the global functions.
     //  maybe something like window.showWarnBox = function(){stuff here};