a1354aabe7a5ccdc84bf559fcb97047df817e29a max Thu Aug 13 04:34:43 2026 -0700 hgTracks: trash-icon custom-track delete also removes it from the image The trash icon in the track list now calls hideTracks() after the delete, the same cleanup as the right-click "Delete Custom Track" path, so a deleted custom track disappears from the image and hgTracks.trackDb right away instead of lingering until the next page reload. Guarded on the track being present in hgTracks.trackDb, since hideTracks()/tdbFindChildless() assume that and a hidden custom track can be deleted from the list while not drawn. refs #38087 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index df8c9deae29..b6d7d116e9c 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -5550,30 +5550,35 @@ // https://genome.ucsc.edu/cgi-bin/hgCustom?hgsid=1645697744_i0Yp2Di71NytSDdb6r0vUbupIvKO&hgct_do_delete=delete&hgct_del_ct_UserTrack_3545=on var hgsid = getHgsid(); var url = 'hgCustom?hgsid='+hgsid+'&hgct_do_delete=delete&hgct_del_'+trackName+'=on'; var xhttp = new XMLHttpRequest(); // this cannot be asyncronous, as users can click quickly here and the hgCustom calls above cannot run in parallel // since we store custom tracks as a text file, not mysql tables xhttp.open("GET", url, false); xhttp.send(); } function onTrackDelIconClick (ev) { /* delete custom track if user clicks its trash icon */ var divEl = ev.target.closest("div"); // must use .closest(), as user can click on either the SVG or the DIV space. var trackName = divEl.getAttribute("data-track"); deleteCustomTrack(trackName); + // if the track is currently drawn, also remove it from the image and update + // hgTracks.trackDb/cart, the same cleanup the right-click delete does. hideTracks() + // assumes the track is in hgTracks.trackDb, so only call it when it is. + if (hgTracks.trackDb && hgTracks.trackDb[trackName]) + rightClick.hideTracks([trackName]); divEl.closest("td").remove(); } function onQuickLiftDelIconClick (ev) { /* Remove this track's stanza from the quickLift hub in trash, and * remove all rows referencing it from the page (it can appear both in * its hub group and in the Visible Tracks group). */ var divEl = ev.target.closest("div"); var trackName = divEl.getAttribute("data-track"); var sourceDb = divEl.getAttribute("data-sourcedb"); var hgsid = getHgsid(); var url = 'hgTrackUi?hgsid=' + hgsid + '&hgTrackUi_op=quickLiftRemove' + '&g=' + encodeURIComponent(trackName) + '&qlSourceDb=' + encodeURIComponent(sourceDb);