-
Notifications
You must be signed in to change notification settings - Fork 189
Fix DQT filter counts when no fields selected #10229
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
base: main
Are you sure you want to change the base?
Fix DQT filter counts when no fields selected #10229
Conversation
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.
Pull request overview
This PR fixes a UI crash in the Data Query Tool that occurred when users removed the PSCID field from the "Define Fields" tab, causing the "Define Filters" tab to become unresponsive. The fix adds proper guards and error handling for the candidate count fetch operation.
Key Changes:
- Added a guard condition to prevent fetching candidate counts when no fields are selected
- Refactored the count-fetching logic from promise chains to async/await with proper abort handling
- Implemented cleanup mechanism using AbortController to cancel in-flight requests when the component unmounts
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| throw new Error('Error creating query.'); | ||
| } | ||
| return resp.json(); | ||
| } | ||
| ).then( | ||
| (data) => { | ||
| fetch( | ||
| '/dataquery/queries/' | ||
| + data.QueryID + '/count', | ||
|
|
||
| const data = await createResp.json(); | ||
| const countResp = await fetch( | ||
| `/dataquery/queries/${data.QueryID}/count`, | ||
| { | ||
| method: 'GET', | ||
| credentials: 'same-origin', | ||
| } | ||
| ).then((resp) => { | ||
| if (!resp.ok) { | ||
| throw new Error('Could not get count.'); | ||
| } | ||
| return resp.json(); | ||
| }).then((result) => { | ||
| signal: controller.signal, | ||
| }, | ||
| ); | ||
|
|
||
| if (!countResp.ok) { | ||
| throw new Error('Could not get count.'); |
Copilot
AI
Dec 14, 2025
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.
The error messages "Error creating query." and "Could not get count." are generic and don't provide helpful context for debugging. Consider including the HTTP status code or response details to help identify the root cause when these errors occur. For example: throw new Error(\Error creating query: ${createResp.status} ${createResp.statusText}`);`
|
@driusan, could you please assign someone to review this PR? I’d really appreciate it. |
Brief summary of changes
tab.
Testing instructions
Descriptions”, open the Data Query Tool.
Filters” tab opens normally.
npm run lint:js(passes; existing repo warnings only).Link(s) to related issue(s)
Before Fix

After Fix
