-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
ref(dashboards): convert generic widget queries to functional component #106182
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
Merged
DominikB2014
merged 8 commits into
master
from
dominikbuszowiecki/browse-238-convert-generic-widget-queries-to-a-functional-component
Jan 14, 2026
Merged
ref(dashboards): convert generic widget queries to functional component #106182
DominikB2014
merged 8 commits into
master
from
dominikbuszowiecki/browse-238-convert-generic-widget-queries-to-a-functional-component
Jan 14, 2026
Conversation
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
static/app/views/dashboards/widgetCard/genericWidgetQueries.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetCard/genericWidgetQueries.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetCard/genericWidgetQueries.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetCard/genericWidgetQueries.tsx
Outdated
Show resolved
Hide resolved
- Fix stale `selection` prop in `transformTable` call by reading from `latestPropsRef` - Fix stale `dashboardFilters` in `applyDashboardFilters` by reading from `latestPropsRef` - Remove setting `queryFetchIDRef` to undefined which caused race condition with active fetches - Refactor queue to use `fetchDataRef` instead of passing function directly - Change deduplication to be based on `fetchDataRef` identity instead of `widgetId` - This solves the remount issue where a new component instance would be blocked by an old queued request - Each component instance now has its own `fetchDataRef`, enabling proper per-instance deduplication - Add `skipDashboardFilterParens` to `latestPropsRef` to avoid stale closure - Remove unnecessary eslint-disable directive These changes address the stale closure bugs identified in PR review comments where widgets would fetch or display data using outdated props when filters changed while requests were queued.
Reset `queryFetchIDRef.current` to undefined when adding a fetch to the queue. This prevents a race condition where an active (not queued) fetch could complete with stale data after props change, briefly displaying incorrect results before the newly queued fetch with updated props executes. Matches the behavior of the original class component implementation.
narsaynorath
approved these changes
Jan 14, 2026
Member
narsaynorath
left a comment
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.
🫡 Nice
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.
This brings us closer to supporting
useQueryin dashboards. I tried to do everything with as minimum changes as possible to avoid any regressions.