-
Notifications
You must be signed in to change notification settings - Fork 16.7k
fix(sqllab): Skip progress bar on no data #37652
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -759,6 +759,13 @@ export default function sqlLabReducer( | |||||
| ? prevState | ||||||
| : currentState, | ||||||
| }; | ||||||
| if ( | ||||||
| newQueries[id].state === QueryState.Success && | ||||||
| newQueries[id].runAsync === false && | ||||||
| !newQueries[id].results | ||||||
| ) { | ||||||
| newQueries[id].state = QueryState.Fetching; | ||||||
| } | ||||||
| if ( | ||||||
| shallowEqual( | ||||||
| omit(newQueries[id], ['extra']), | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: In the refresh-queries handler, the equality optimization dereferences Severity Level: Critical 🚨- ❌ Reducer throws during REFRESH_QUERIES processing.
- ❌ SQL Lab query list UI can fail to update.
- ⚠️ Polling/updates drop for affected query ids.
Suggested change
Steps of Reproduction ✅1. In the running app, trigger the REFRESH_QUERIES reducer path by dispatching the
actions.REFRESH_QUERIES action. The reducer handler is in
superset-frontend/src/SqlLab/reducers/sqlLab.ts inside the [actions.REFRESH_QUERIES]()
block (the handler begins in the PR diff around lines 749-776).
2. Include an alteredQueries payload that contains a new query id not present in the
current Redux state. Example payload: { alteredQueries: { "newId": { state: "success", /*
other fields */ } } }. This causes the forEach branch guarded by the check at the top of
the loop (the clause that starts with "!state.queries.hasOwnProperty(id)" in the same
handler) to execute for that id.
3. Execution reaches the equality-optimization block starting at the if ( shallowEqual(...
) && isEqual(... ) ) { ... } portion (the block shown in the diff at ~lines 770-775).
Because state.queries["newId"] is undefined, the expression state.queries[id].extra is
evaluated and raises a TypeError (cannot read property 'extra' of undefined).
4. Observe a runtime exception thrown from the reducer path in the browser console and a
broken UI update for SQL Lab queries. The failure occurs deterministically when
REFRESH_QUERIES contains query IDs not already present in state. (If the reviewer
considers this a non-issue: the code's earlier condition explicitly allows this branch for
new ids by design, so the missing guard is a real bug.)Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** superset-frontend/src/SqlLab/reducers/sqlLab.ts
**Line:** 771:771
**Comment:**
*Null Pointer: In the refresh-queries handler, the equality optimization dereferences `state.queries[id].extra` without checking if the query already exists in state, but this block runs even when `!state.queries.hasOwnProperty(id)` is true, so for new query IDs `state.queries[id]` is `undefined` and accessing `.extra` will throw at runtime when `refreshQueries` is called with a previously unseen ID.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||
|
|
||||||
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.
Suggestion: The condition that checks for synchronous queries uses a strict comparison
runAsync === false, which will not match cases whererunAsyncisundefinedornulleven though those are effectively non-async runs, so such queries can incorrectly remain in the "success" state with no results and still show the confusing UI that this change intends to fix. Relaxing the check to treat any falsyrunAsyncas synchronous will make the logic robust against missing or optionalrunAsyncvalues from the backend. [possible bug]Severity Level: Major⚠️
Steps of Reproduction ✅
Prompt for AI Agent 🤖