sadpandajoe opened a new pull request, #42318:
URL: https://github.com/apache/superset/pull/42318

   ### SUMMARY
   
   When a SQL Lab query is run asynchronously and fails, its error was rendered 
**twice** in the results panel. This is the "doubled error messages on SQL Lab 
fallback" a customer reported.
   
   **Root cause:** on the async polling path a failed query stores the *same* 
error array in two places in Redux:
   
   - `QueryAutoRefresh` → `refreshQueries` → `REFRESH_QUERIES` reducer 
populates `query.extra.errors`.
   - immediately after, `queryFailed(query, ..., query.extra?.errors)` → 
`QUERY_FAILED` reducer stores the identical array into `query.errors`.
   
   `ResultSet` rendered the concatenation of both arrays:
   
   ```ts
   const errors = [...(query.extra?.errors || []), ...(query.errors || [])];
   ```
   
   so every error rendered twice via `ErrorMessageWithStackTrace`. The 
synchronous path only sets `query.errors`, which is why it was only doubled "on 
fallback".
   
   **Fix:** deduplicate the combined list (keyed by `JSON.stringify`) before 
rendering, so each error shows exactly once while genuinely distinct errors 
from either source are still preserved. No change to the synchronous path.
   
   ### TESTING INSTRUCTIONS
   
   - New Jest test `deduplicates errors present in both query.errors and 
query.extra.errors` in `ResultSet.test.tsx`.
   - Full `ResultSet` suite passes (37/37). Reverting only the fix makes the 
new test fail with `Expected length: 2 / Received length: 4`, confirming the 
guard.
   - Manual: run an async query in SQL Lab that fails (e.g. bad SQL against an 
async-enabled DB) and confirm the error now appears once.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue
   - [x] Required feature flags: N/A
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to