fix(explore): increase logs infinite query maxPages when we don't have many rows locally#112691
Merged
JoshuaKGoldberg merged 3 commits intomasterfrom Apr 15, 2026
Merged
fix(explore): increase logs infinite query maxPages when we don't have many rows locally#112691JoshuaKGoldberg merged 3 commits intomasterfrom
JoshuaKGoldberg merged 3 commits intomasterfrom
Conversation
Use a lower page cap until enough rows are cached locally, then allow a higher cap. Co-Authored-By: Cursor Agent <noreply@cursor.com> Made-with: Cursor
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Inverted condition returns wrong maxPages limit
- Inverted the ternary condition so that fewer rows (<500) returns the higher limit (300) and more rows (≥500) returns the lower limit (30), and corrected the JSDoc comment.
Or push these changes by commenting:
@cursor push 403f4fffa2
Preview (403f4fffa2)
diff --git a/static/app/views/explore/logs/constants.tsx b/static/app/views/explore/logs/constants.tsx
--- a/static/app/views/explore/logs/constants.tsx
+++ b/static/app/views/explore/logs/constants.tsx
@@ -22,7 +22,7 @@
export const MAX_LOGS_INFINITE_QUERY_PAGES = 30; // This number * the refresh interval must be more seconds than 2 * the smallest time interval in the chart for streaming to work.
/** Larger page cap once enough rows are cached (see useInfiniteLogsQuery). */
export const MAX_LOGS_INFINITE_QUERY_PAGES_EXPANDED = 300;
-/** Below this many rows in the client cache, use {@link MAX_LOGS_INFINITE_QUERY_PAGES}. */
+/** Below this many rows in the client cache, use {@link MAX_LOGS_INFINITE_QUERY_PAGES_EXPANDED}. */
export const LOCAL_LOG_ROWS_FOR_EXPANDED_INFINITE_PAGES = 500;
/**
diff --git a/static/app/views/explore/logs/useLogsQuery.tsx b/static/app/views/explore/logs/useLogsQuery.tsx
--- a/static/app/views/explore/logs/useLogsQuery.tsx
+++ b/static/app/views/explore/logs/useLogsQuery.tsx
@@ -414,8 +414,8 @@
const rows =
cached?.pages?.reduce((n, page) => n + (page[0]?.data?.length ?? 0), 0) ?? 0;
return rows < LOCAL_LOG_ROWS_FOR_EXPANDED_INFINITE_PAGES
- ? MAX_LOGS_INFINITE_QUERY_PAGES
- : MAX_LOGS_INFINITE_QUERY_PAGES_EXPANDED;
+ ? MAX_LOGS_INFINITE_QUERY_PAGES_EXPANDED
+ : MAX_LOGS_INFINITE_QUERY_PAGES;
}
export function useInfiniteLogsQuery({This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aec7539. Configure here.
k-fish
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Previously, the
maxPagesfor infinitely querying logs was hardcoded to 30 (MAX_LOGS_INFINITE_QUERY_PAGES). This is good in case there are many big logs to amke sure the local browser doesn't run out of data. But if there are many "blank" pages (gaps) of query results, which can happen when the logs are very sporadic, we end up hitting the maximum page limit for queries and losing some.This goes for a higher 300 (
MAX_LOGS_INFINITE_QUERY_PAGES_EXPANDED) when there are fewer than 500 (LOCAL_LOG_ROWS_FOR_EXPANDED_INFINITE_PAGES) rows locally. We're thinking this should allow more pages so we don't bump into the max storage - while not risking running out of browser memory.Fixes EXP-865
Made with Cursor
The RCA and solution idea for this came from @k-fish (🥔), so essentially:
Co-authored-by: @k-fish