-
Notifications
You must be signed in to change notification settings - Fork 713
fix: handle empty hits with streaming aggs #8411 #8412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR addresses a specific edge case in streaming aggregations where empty or null hits arrays could cause issues in the dashboard panel data loader. The change adds defensive null/empty checks in three critical locations within usePanelDataLoader.ts before copying search result hits when streaming aggregations are enabled.
The modifications target three different response handling scenarios:
- Partition-based streaming aggregations (lines 594-598) - Checks if
searchRes?.data?.hits?.length > 0before updatingstate.data - Histogram response handling (lines 704-710) - Validates
searchRes?.content?.results?.hits?.length > 0before state updates - Streaming histogram hits (lines 760-766) - Similar validation for streaming histogram data
Each check follows the same pattern: only update state.data[currentQueryIndex] when there are actual hits with content, preventing the assignment of empty arrays that could confuse the UI about loading states versus truly empty result sets. This is particularly important for real-time streaming scenarios where partial results arrive in chunks and preserving existing data until meaningful results arrive is crucial.
The change integrates well with the existing codebase's error handling patterns and maintains the streaming aggregation functionality while making it more robust against edge cases where the backend might return valid metadata but no actual data points.
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it only adds defensive checks without changing core logic
- Score reflects simple defensive programming changes that reduce potential runtime issues without introducing complexity
- No files require special attention as the changes are straightforward null checks with consistent patterns
1 file reviewed, 2 comments
PR Code Suggestions ✨Explore these optional code suggestions:
|
d1246c8 to
d9e3c92
Compare
d9e3c92 to
d88acf2
Compare
PR Type
Bug fix
Description
Skip state updates for empty streaming hits
Prevent overwriting data with empty arrays
Apply fix across loader code paths
Diagram Walkthrough
File Walkthrough
usePanelDataLoader.ts
Guard state updates against empty streaming hitsweb/src/composables/dashboard/usePanelDataLoader.ts