0fdb3efce5b32f4bbc5b134a86872f0ddd33b306
galt
  Tue Aug 19 15:28:26 2025 -0700
Revert "Remove preload since it adds complications for multi-region without any improvement since the automatic wiggle code works fine without it.. Fixes #35580"

This reverts commit b6ef83c2f06ae1928e9fabf8ee84a72b3ef1d2a0.

This is the second commit on dev branch rm35580-noPreloadInbigBedTrack

diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c
index 5b151a8396a..7e4aa8d367d 100644
--- src/hg/hgTracks/bigBedTrack.c
+++ src/hg/hgTracks/bigBedTrack.c
@@ -483,34 +483,79 @@
     maxItems = sqlUnsigned(maxItemsStr);
     set = TRUE;
     }
 
 return maxItems;
 }
 
 struct bigBedInterval *bigBedSelectRangeExt(struct track *track,
 	char *chrom, int start, int end, struct lm *lm, int maxItems)
 /* Return list of intervals in range. */
 {
 struct bigBedInterval *result = NULL;
 /* protect against temporary network error */
 struct errCatch *errCatch = errCatchNew();
 
+//GALT DEBUG RESTORE ? boolean filtering = FALSE; // for the moment assume we're not filtering
+
 if (errCatchStart(errCatch))
     {
     struct bbiFile *bbi = fetchBbiForTrack(track);
     result = bigBedIntervalQuery(bbi, chrom, start, end, bigBedMaxItems() + 1, lm);
+    /*  //GALT DEBUG RESTORE 
+    This causes some real issues for MR, I have a work-around on another branch,
+    but since hgTracks already has code that works right and sets limitWiggle for tracks automatically,
+    without this, testing is not helping.
+
+    if (slCount(result) > bigBedMaxItems())
+	{
+        if (filtering)
+            errAbort("Too many items in window to filter.Zoom in or remove filters to view track.");
+        else
+            {
+            // use summary levels
+            if (track->visibility != tvDense)
+                {
+                track->limitedVis = tvFull;
+                track->limitWiggle = TRUE;
+                track->limitedVisSet = TRUE;
+                }
+            else
+                {
+                track->limitedVis = tvDense;
+                track->limitedVisSet = TRUE;
+                }
+            result = NULL;
+            AllocArray(track->summary, insideWidth);
+            if (bigBedSummaryArrayExtended(bbi, chrom, start, end, insideWidth, track->summary))
+                {
+                char *denseCoverage = trackDbSettingClosestToHome(track->tdb, "denseCoverage");
+                if (denseCoverage != NULL)
+                    {
+                    double endVal = atof(denseCoverage);
+                    if (endVal <= 0)
+                        {
+                        AllocVar(track->sumAll);
+                        *track->sumAll = bbiTotalSummary(bbi);
+                        }
+                    }
+                }
+            else
+                freez(&track->summary);
+            }
+        }
+        */
     track->bbiFile = NULL;
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError)
     {
     track->networkErrMsg = cloneString(errCatch->message->string);
     track->drawItems = bigDrawWarning;
     track->totalHeight = bigWarnTotalHeight;
     result = NULL;
     }
 errCatchFree(&errCatch);
 
 return result;
 }