14f0e7fd728cdbfae3389e494fd98bc4a29d5c4f
chmalee
  Tue Jan 14 13:53:59 2025 -0800
Update history state on row removal in hubSpace UI so after removing a file, clicking a link to view a separate file in the genome browser and then hitting the web browser back button shows the correct state

diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js
index adbbadd..32d2e4a 100644
--- src/hg/js/hgMyData.js
+++ src/hg/js/hgMyData.js
@@ -367,30 +367,33 @@
             viewBtn.type = 'button';
             viewBtn.addEventListener("click", function() {
                 viewInGenomeBrowser(rowData.fileName, rowData.fileType, rowData.genome, rowData.parentDir);
             });
             container.appendChild(viewBtn);
             return container;
         }
     }
 
     function deleteFileFromTable(pathList) {
         // req is an object with properties of an uploaded file, make a new row
         // for it in the filesTable
         let table = $("#filesTable").DataTable();
         let rows = table.rows((idx, data) => pathList.includes(data.fullPath));
         rows.remove().draw();
+        let toKeep = (elem) => !pathList.includes(elem.fullPath);
+        uiState.fileList = uiState.fileList.filter(toKeep);
+        history.replaceState(uiState, "", document.location.href);
     }
 
     function addFileToHub(rowData) {
         // a file has been uploaded and a hub has been created, present a modal
         // to choose which hub to associate this track to
         // backend wise: move the file into the hub directory
         //               update the hubSpace row with the hub name
         // frontend wise: move the file row into a 'child' of the hub row
         console.log(`sending addToHub req for ${rowData.fileName} to `);
         cart.setCgi("hgHubConnect");
         cart.send({addToHub: {hubName: "", dataFile: ""}});
         cart.flush();
     }