3d25b107ddba698eee9ca53c5ea106064052eb26 braney Tue Jul 28 14:17:33 2020 -0700 fix problem with config tracks changing the cart when nothing had actually changed (for Kate) diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 423316e..b5f3b0c 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -7138,32 +7138,44 @@ printf("<td align=%s>", cg->align); else printf("<td>"); } static void pruneRedundantCartVis(struct track *trackList) /* When the config page or track form has been submitted, there usually * are many track visibility cart variables that have not been changed * from the default. To keep down cart bloat, prune those out before we * save the cart. changeTrackVis does this too, but this is for the * more common case where track visibilities are tweaked. */ { struct track *track; for (track = trackList; track != NULL; track = track->next) { + if (track->parent) // has super track + pruneRedundantCartVis(track->parent); + char *cartVis = cartOptionalString(cart, track->track); - if (cartVis != NULL && hTvFromString(cartVis) == track->tdb->visibility) + if (cartVis == NULL) + continue; + + if (tdbIsSuper(track->tdb)) + { + if ((sameString("hide", cartVis) && (track->tdb->isShow == 0)) || + (sameString("show", cartVis) && (track->tdb->isShow == 1))) + cartRemove(cart, track->track); + } + else if (hTvFromString(cartVis) == track->tdb->visibility) cartRemove(cart, track->track); } } static int getMaxWindowToDraw(struct trackDb *tdb) /* If trackDb setting maxWindowToDraw exists and is a sensible size, return it, else 0. */ { if (tdb == NULL) return 0; char *maxWinToDraw = trackDbSettingClosestToHome(tdb, "maxWindowToDraw"); if (isNotEmpty(maxWinToDraw)) { unsigned maxWTD = sqlUnsigned(maxWinToDraw); if (maxWTD > 1) return maxWTD;